android dev : basic things to know

Android swap screen

Alt+1 : swap from GUI to terminal
Alt+7 : swap back to GUI

TIPS : Make a mouse works for Android in VirtualBox by

Machine > Disable Mouse Integration : Host+I

Android shell command

view ipaddress

$ netcfg 


where is it ?

The program is at /android-sdk-linux/platform-tools


Set NAT in VirtualBox and set forward port to 5555

– for windows just leave `*` field blank
– use Adapter : PC-net Fast III (Am 79C973)

– Machine > ACPI shutdown ; to wake up from the android black screen of death

$ ./adb connect

shell command

$ ./adb shell
# ls 


$ ./adb shell ls

NOTE : for debug ndk

$ ./ndk-gdb connect


– your adb must be in the PATH

– we have to set `ndk-build NDK_DEBUG=1` in  Properties -> C/C++ Build

– put in the application tag in AndroidManifest.xml


– to use that Debug As > Android Application

The detail of step above can be found here


$ ./adb install ../bin/something.apk 

NOTE : – no need to transfer apk to the android device. we can use apk on our laptop

– If there are more than one device and emulator, the error will be

error: more than one device and emulator

just, select the device using -s i.e. `-s`

The device can be listed using the following command

$ ./adb devices

– If we try to install again if will show the error that package is already exists


to override, we use option -r

run program

 $ ./adb shell am start -a android.intent.action.MAIN -n com.example.mypackagetest/.MainActivity

NOTE : see invoking path from AndroidManifest.xml

push file

$ ./adb push remote local

pull file

$ ./adb pull local remote

see the log

inside your application



$ ./adb logcat

more about adb command here

java in eclipse

– build all button is next to the printer button ( or we can use Ctrl+B ), but normally eclipse built that for us on the fly.

– anyway, the eclipse will create the apk file, only when we press ‘run’ ( not ‘build’ )

– after ./adb connect, we can select VM ADT in eclipse

– input type must be defined warning will be solved by, show in > property

List Example



android:layout_height="wrap_content" >
</ListView><span style="line-height: 1.5;">