Monday, December 28, 2009

Android Dev Notes

Attach android source to Eclipse:



http://stuffthathappens.com/blog/2008/11/01/browsing-android-source-in-eclipse/

Basically, download source from google and copy frameworks/base/core/java/ to android-sdk/platforms/android-version/sources.

But it didn't work at first attempt. It turns out eclipse's cache is preventing source from showing up. Deleted some directories (don't remember exactly what I deleted :) under eclipse-workspace/.metadata/.plugins/org.eclipse.core.resources/.history and .projects directory. Then the source file begins to show up.

The link for downloading source code is like this: http://git.source.android.com/?p=platform/frameworks/base.git;a=snapshot;h=HEAD;sf=tgz (Thanks for http://geekycoder.wordpress.com/2009/07/03/how-to-download-latest-zip-android-source-code-and-using-it-in-intellij/) This link is for HEAD, if you want to download tagged version, such as 1.5, you have to find the correct value for "h" as in "h=HEAD". It can be found here: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=summary. Click any version you want, then in the URL, you can see the parameter value for "h".

Code Optimization for Dalvik VM



Accessing a local variable is much more efficient than accessing a field in the Dalvik VM. So creating a new local variable to refer to field variable will make the routine much more efficient. It is recommended that you use this optimization when possible.

No comments:

Post a Comment