Archive for the ‘Android’ Category

I have an Android project using DrawerLayout, it’s working fine except that when touching on the empty area of the drawer, the touch events are caught by views behind.

To resolve it, you can add android:clickable=”true” to the drawer view.

< xmlns:android="" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent">
    <FrameLayout android:id="@+id/content_view" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
    <FrameLayout android:id="@+id/drawer_view" android:layout_width="300dp" <strong>android:clickable="true"</strong> android:importantForAccessibility="no" android:layout_height="match_parent" android:layout_gravity="left"/>

But if your drawer view is included using fragment instead of framelayout, you need add the android:clickable=”true” to the root tag of the fragment layout xml.



When you have multiple EditText in a screen, it’s nice to allow users to move to the next EditText when pressing the Next button in keyboard. android:nextFocusForward is the solution, but it may be not working for AutoCompleteTextView.

To fix it, just add the below to AutoCompleteTextView markup in the layout xml


I have succeed to set the hosts file in my emulator for a while, but recently it just stopped working. I can verify that the hosts was uploaded to the /etc directory, but it was just ignored by the system.

To solve it is extremely easy, just make sure that your hosts file has an extra line after the last line of text…

PS: if you don’t know how to modify the emulator hosts file, you can refer to my other post here

Android: upload files to emulator

Posted: October 6, 2015 in Android

Below command will upload a local images directory to emulator SD Card.

$adb -s target-device remount
$adb -s target-device push "C:\images" /storage/sdcard/Pictures

reboot your emulator.

Note: In Android 6 emulators, the real sdcard directory is some random named folder such as /storage/1122-223x. You can use either shell or Android Device Monitor to find the exact name.

I encountered this error when copying file to emulator SD card. The below solution resolves this error.

$adb -s target-device shell
$mount -o rw,remount rootfs /
$chmod 777 /mnt/sdcard


We all know that Android emulator is very very slow.

I have tried many tuning tips, but none of them works. Finally the below solution from Intel really works, the emulator is noticeably faster now after installing the Hardware Accelerated Execution Manager.

The HAXM is located in /extras/intel/Hardware_Accelerated_Execution_Manager directory.

All WebView methods must be called on the same thread.

Javascript interface callbacks are performed in a background thread, so to call WebView method, we need post it to the UI thread. Runnable() {
     public void run() {