Thursday, July 2, 2015

Useful Links

How to Enable the Developer Options in Android 4.2 on Nexus 4
http://www.valuewalk.com/2013/05/how-to-enable-the-developer-options-in-android-4-2-on-nexus-4/

INSTALL_FAILED_UPDATE_INCOMPATIBLE when I try to install compiled Trebuchet.apk on device
http://solvedstack.com/questions/install_failed_update_incompatible-when-i-try-to-install-compiled-trebuchet-apk-on-device

Gradle and Android Studio.....

R.java
http://developer.android.com/guide/topics/resources/accessing-resources.html
Once you provide a resource in your application (discussed in Providing Resources), you can apply it by referencing its resource ID

http://stackoverflow.com/questions/20673625/android-gradle-plugin-0-7-0-duplicate-files-during-packaging-of-apk

Undo 'git add' before commit
http://stackoverflow.com/questions/348170/undo-git-add-before-commit

getContex
http://stackoverflow.com/questions/13684094/how-can-we-access-context-of-an-application-in-robolectric

Android unitTest support
http://tools.android.com/tech-docs/unit-testing-support

make android emulator smaller
http://stackoverflow.com/questions/2359895/android-emulator-screen-too-tall

Implements vs. Extends in Java
http://stackoverflow.com/questions/10839131/implements-vs-extends-when-to-use-whats-the-difference

List vs. Arraylist
http://stackoverflow.com/questions/2279030/type-list-vs-type-arraylist-in-java

Array vs. Arraylist
First and Major difference between Array and ArrayList in Java is that Array is a fixed length data structure while ArrayList is a variable length Collection class. You can not store primitives in ArrayList.
http://java67.blogspot.com/2012/12/difference-between-array-vs-arraylist-java.html

Android Category
The BROWSABLE category is required in order for the intent filter to be accessible from a web browser. Without it, clicking a link in a browser cannot resolve to your app. The DEFAULT category is optional, but recommended. Without this category, the activity can be started only with an explicit intent, using your app component name.
https://developer.android.com/training/app-indexing/deep-linking.html

Android Webview
http://developer.android.com/guide/webapps/webview.html

Purpose of using buildscript in build.gradle
http://stackoverflow.com/questions/17773817/purpose-of-buildscript-in-gradle

Androidmanifest path&pathprefix&path
The path part of a URI which must begin with a /. The path attribute specifies a complete path that is matched against the complete path in an Intent object. The pathPrefix attribute specifies a partial path that is matched against only the initial part of the path in the Intent object. The pathPattern attribute specifies a complete path that is matched against the complete path in the Intent object, but it can contain the following wildcards:
http://developer.android.com/guide/topics/manifest/data-element.html

scheme://host:port/path or pathPrefix or pathPattern
        <activity
            android:name=".infra.deeplink.DeepLinkHelperActivity"
            android:configChanges="keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <!--  For Deep Linking -->
                <data
                    android:host="www.linkedin.com"
                    android:pathPrefix="/voyager"
                    android:scheme="https" />
            </intent-filter>
        </activity>


Troubleshooting
logansquare com.bluelinelabs.logansquare.nosuchmapperexception could not be mapped to a json object
Sol: proguard-rules.txt!!
https://github.com/bluelinelabs/LoganSquare

hashMap vs arrayMap
ArrayMap is a generic key->value mapping data structure that is designed to be more memory efficient than a traditional HashMap.
https://developer.android.com/reference/android/support/v4/util/ArrayMap.html

pass class into the method is slow
Reflection?

Remove files from Git commit
If I made the wrong commit, not pushed yet....
http://stackoverflow.com/questions/12481639/remove-files-from-git-commit

Merge latest two commits into one
$ git reset --soft "HEAD^"
$ git commit --amend
http://stackoverflow.com/questions/2563632/how-can-i-merge-two-commits-into-one

Transparent activity in Android
http://stackoverflow.com/questions/2176922/how-to-create-transparent-activity-in-android

 To allow your app to take advantage of these changes and ensure that your app fits the style of each user's device, you should set the targetSdkVersion value to match the latest Android version available.

Intent ACTION_VIEW
action -- The general action to be performed, such as ACTION_VIEW, ACTION_EDIT, ACTION_MAIN, etc.
data -- The data to operate on, such as a person record in the contacts database, expressed as a Uri.
http://developer.android.com/reference/android/content/Intent.html

Android click event outside a dialog
Dialog dialog = new Dialog(getActivity());
Window window = dialog.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.setCanceledOnTouchOutside(false);
dialog.show();
http://stackoverflow.com/questions/9516287/android-click-event-outside-a-dialog

Git patch apply
$ git apply ../rb562855.patch
http://makandracards.com/makandra/2521-git-how-to-create-and-apply-patches

No underline for drawable in android
http://stackoverflow.com/questions/18869605/failed-to-convert-drawable-into-a-drawable

FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which means that the view wants to be as big as its parent (minus padding)
WRAP_CONTENT, which means that the view wants to be just big enough to enclose its content (plus padding)

bring view on front of everything
yourView.bringToFront();
http://stackoverflow.com/questions/6759279/how-to-bring-view-on-front-of-everything

Set radius in Android
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF"/>
    <corners android:radius="10dip"/>
</shape>
http://stackoverflow.com/questions/16161448/how-to-make-layout-with-rounded-corners

Slide down and gone
Cool!
view.animate()
    .translationY(0)
    .alpha(0.0f)
    .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(View.GONE);
        }
    });
http://stackoverflow.com/questions/19765938/show-and-hide-a-view-with-a-slide-up-down-animation


Error:Timeout waiting to lock buildscript class cache for build file
delete everything under ~/.gradle/caches


No comments:

Post a Comment