Thursday, May 26, 2011

Android Run Down

The documentation for Android is horrible. These sites can get past many of the documentation blockers.

-Problems with Eclipse

If you get a 'foo' error when you run a vm like
invalid command-line parameter: Files.
Hint: use '@foo' to launch a virtual device named 'foo'.
please use -help for more information
goto this
If ctrl space items don't show up goto Window->Preferences->Java dropdown->Editor dropdown->Content Assist->Advanced Select the items that don't show up.
If you refactor the id of an xml element. Not only will the eclipse plugin not change the name, the syntax checker will not throw an error regardless if an element with that name still exists.
For programmatically changing XML interfaces you have to use setContentView(xmlfile) then you change the elements. A nice side effect is that two xml layout files can have the same ids for elements.

-Speeding up Eclipse (increasing memory heapsize)
I find adding these commands helpful:
-vmargs -Xmx512M

-Using highlighting to spot syntax errors

-Resizing the Emulator Screen
Starting with Android 1.6 the Android emulator switched to a bigger startup screen which doesn't fit on my laptop computer. Switch to HVGA for a smaller screen.

-Speeding up the emulator (with pictures)
I personally have had good results with: vm.heapsize 512, hw.ramSize 512, HVGA, and snapshot with Android 2.3.3. (Still takes a long time to startup but with snapshot startups are somewhat fast, closes are slow but increasing the heapsize minimizes that time. This is important as I keep accidently closing the emulator or sometimes eclipse has problems talking with the emulator and both need to be restarted.)

-Comprehensive ListView Examples

-How to use SQLite in Android (hint you need _id and the table android_metadata)

-How to use cursors in Android

-How to use simplecursoradapter in Android (alot of sites do not give good documentation on the fields)

-Making good looking UIs and other Android topics walkthrough

-Using a viewlist or spinner programmatically.

-Using the canvas for animations (games or special visual effects)

Android Java docs (there are some classes not talked about in the public android docs)

Quick Notes
Use sp for text and dp for everything else. Sp scales with the user font size. (Pragmatic Programmer)
Ctrl+F11 or 7 or 9 (on keypad) will switch the phone between horizontal and vertical modes.


No comments:

Post a Comment