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
adb
where is it ?
The program is at /android-sdk-linux/platform-tools
connect
Set NAT in VirtualBox and set forward port to 5555
NOTE :
– 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 127.0.0.1:5555
shell command
$ ./adb shell # ls
or
$ ./adb shell ls
NOTE : for debug ndk
$ ./ndk-gdb connect 127.0.0.1:5555
but
– 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
android:debuggable="true"
– to use that Debug As > Android Application
The detail of step above can be found here
install
$ ./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 127.0.0.1:5555`
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
Failure [INSTALL_FAILED_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
Log.v(STRING_TAG, STRING);
$ ./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
<ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView><span style="line-height: 1.5;">