Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Know thy code<br />Framework<br />
Know thy code ???.*<br />What we wont know after this talk<br />Code review secrets <br />Know my code <br />What we will ...
Android – Open Source<br /> Android has been available under a free software/open source license since October, 21 2008<br...
Android – Open Source<br />Source available at source.android.com.<br />Source is a bunch of git projects.<br />Google bui...
What code will we be seeing<br />
Framework source in eclipse<br />Source code from major release-specific branches can be downloaded like this:<br />http:/...
Framework source in eclipse<br />Extract the android folder from <br /><tarball>/core/java/ <br />into <br />android-sdk/p...
Alternate “cloud” source viewer<br />Chrome extension : bit.ly/andsrcchrome<br />	Adds an 'ad' command to the Chrome Omnib...
Alternate “cloud” source viewer<br />
Getting hands dirty<br />
Getting hands dirty<br />publicclassSeekBarextendsAbsSeekBar<br />publicabstractclassAbsSeekBarextendsProgressBar<br />mTh...
Getting hands dirty<br />Story : HTTP Requests <br />
Getting hands dirty<br />publicabstractclassAsyncTask<Params, Progress, Result> {<br />privatestaticfinal String LOG_TAG =...
Performance examples<br />publicclassSQLiteDatabaseextendsSQLiteClosable<br />Android implements locking in SQLiteDatabase...
Questions?<br />Thank you.<br />
Nächste SlideShare
Wird geladen in …5
×

Know thy code

How to build bet

  • Loggen Sie sich ein, um Kommentare anzuzeigen.

  • Gehören Sie zu den Ersten, denen das gefällt!

Know thy code

  1. 1. Know thy code<br />Framework<br />
  2. 2. Know thy code ???.*<br />What we wont know after this talk<br />Code review secrets <br />Know my code <br />What we will learn from it ( Hopefully )<br />How to make better use of framework source<br />How to make new components from the framework<br />Framework<br />
  3. 3. Android – Open Source<br /> Android has been available under a free software/open source license since October, 21 2008<br />Google published the entire source code (including network and telephony stacks) under an Apache License.<br />
  4. 4. Android – Open Source<br />Source available at source.android.com.<br />Source is a bunch of git projects.<br />Google built repo on top of git.<br />Souce is ~3GB , needs ~10GB to build.<br />Currently only builds on Linux and Mac<br />
  5. 5. What code will we be seeing<br />
  6. 6. Framework source in eclipse<br />Source code from major release-specific branches can be downloaded like this:<br />http://android.git.kernel.org/?p=platform/frameworks/base.git;a=snapshot;h=refs/heads/froyo;sf=tgz<br />You can get other versions by changing the branch name (froyo) in the link above (to donut, gingerbread, etc.)<br />Links : https://bitly.com/bundles/rvyas/1<br />
  7. 7. Framework source in eclipse<br />Extract the android folder from <br /><tarball>/core/java/ <br />into <br />android-sdk/platforms/<platform version>/sources/<br />Make sure the platform-version is the same as the android version of the tarball.<br />Refresh project in eclipse <br />To test press Alt + Shift + T to check if you can view the activity class <br />Source : http://kmansoft.wordpress.com/2011/01/27/android-sources-for-debugging/<br />
  8. 8.
  9. 9. Alternate “cloud” source viewer<br />Chrome extension : bit.ly/andsrcchrome<br /> Adds an 'ad' command to the Chrome Omnibox<br />
  10. 10. Alternate “cloud” source viewer<br />
  11. 11. Getting hands dirty<br />
  12. 12. Getting hands dirty<br />publicclassSeekBarextendsAbsSeekBar<br />publicabstractclassAbsSeekBarextendsProgressBar<br />mThumbOffset= thumb.getIntrinsicWidth() / 2;<br />setThumbPos(getWidth(), thumb, scale, Integer.MIN_VALUE);<br />setThumbPos(w, thumb, scale, 0);<br />Modified code : http://bit.ly/andvsb<br />
  13. 13. Getting hands dirty<br />Story : HTTP Requests <br />
  14. 14. Getting hands dirty<br />publicabstractclassAsyncTask<Params, Progress, Result> {<br />privatestaticfinal String LOG_TAG = "AsyncTask";<br />privatestaticfinalintCORE_POOL_SIZE = 5;<br />privatestaticfinalintMAXIMUM_POOL_SIZE = 128;<br />privatestaticfinalintKEEP_ALIVE = 10;<br />privatestaticfinalBlockingQueue<Runnable> sWorkQueue =<br />newLinkedBlockingQueue<Runnable>(10);<br />privatestaticfinalThreadFactorysThreadFactory = newThreadFactory() {<br />privatefinalAtomicIntegermCount = newAtomicInteger(1);<br />public Thread newThread(Runnable r) {<br />returnnew Thread(r, "AsyncTask #" + mCount.getAndIncrement());<br /> }<br /> };<br />
  15. 15. Performance examples<br />publicclassSQLiteDatabaseextendsSQLiteClosable<br />Android implements locking in SQLiteDatabase<br />- No point trying to hit the database from multiple threads<br />- On the positive you don’t need to synchronize your requests.<br />
  16. 16. Questions?<br />Thank you.<br />

×