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

http://www.wallpaperama.com/forums/_wlxpee.html
-
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)
http://wiki.eclipse.org/FAQ_How_do_I_increase_the_heap_size_available_to_Eclipse%3F
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)
http://stackoverflow.com/questions/1554099/slow-android-emulator
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
http://www.vogella.de/articles/AndroidListView/article.html

-How to use SQLite in Android (hint you need _id and the table android_metadata)
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

-How to use cursors in Android
http://www.higherpass.com/Android/Tutorials/Accessing-Data-With-Android-Cursors/3/

-How to use simplecursoradapter in Android (alot of sites do not give good documentation on the fields)
http://www.higherpass.com/Android/Tutorials/Creating-Lists-Using-The-Android-Listactivity/3/

-Making good looking UIs and other Android topics walkthrough
http://marakana.com/techtv/android_bootcamp_screencast_series.html

-Using a viewlist or spinner programmatically.


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

Android Java docs (there are some classes not talked about in the public android docs)
http://www.androidjavadoc.com/2.3/index.html

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.

Ciao

No comments:

Post a Comment