Sunday, May 2, 2010

Regular update, May 1st

Videos watched & notes taken + reading materials


Androidology - Architecture Overview [ link ]

Decompose the app into application building blocks, which include
  • Activities
  • BroadcastReceivers (triggered by any event)
  • Services
  • ContentProviders
Androidology - Application Lifecycle [ link ]
Androidology - APIs [ link ]


Google I/O 2009 - ...Make your Android UI Fast and Efficient [ link ] (good one!)
  • reuse views with Recycler for higher fps
  • prescale bitmaps with
    image = Bitmap.createPrescaledBitmap(image, view.getWidth(), view.getHeight(), true);
  • remove backgrounds from views, which fill parents full width and height (eg if you have a map, you don't see the background, which is still rendered) [00:17:23]
  • invalidate() to redraw a view is inefficient, use invalidate(rect) or invalidate(left, top, right, bottom)
  • fewer (views) is better ;) (try to get rid of views that have only one child, too: HierarchyViewer)
  • use compound drawables (eg TextView instead of ImageView+TextView)
  • use ViewStub to inflate part of the UI on demand (eg for part of the UI that for majority of the time is invisible) [00:35:20]
  • use merge tag to reuse UI hierarchy elements
  • RelativeLayout instead of embedding linear layouts; hard to use, but it pays off
  • use custom views, custom layouts instead of overusing numerous views
  • garbage collection kicks in for 100~500ms, stops threads (so allocate little memory, or even none :d)
  • do not allocate memory in those time-critical points:
onMeasure()
onLayout()
draw()
dispatchDraw()
onDraw()
dispatchTouchEvent()

onTouchEvent()
getView()
bindView()
  • SoftReferences != WeakReferences [00:51:17]
  • soft references are good for caching objects
  • weak references help avoid mem leaks
  • pool of objects (frameworks/base/core/java/android/util, find Pools.java)
Resources:
http://d.android.com
http://source.android.com (includes examples of relative layouts)
http://android.git.kernel.org
http://code.google.com/p/apps-for-android (about good quality UI)
http://code.google.com/p/shelves (about good quality UI)

Google I/O 2009 -...Interaction & Visual Design with Android [ link ]


  • ongoing notification (eg for downloading a file) vs event notification
  • uninvasive notification - Toast ;D
  • use Marquee to animate strings (eg for long filenames) [00:38:10]
  • built-in scalable pixel units typography [00:38:38] for font scaling (eg on the files list)
Resources:
http://android-developers.blogspot.com

Reading materials
http://developer.android.com/sdk/index.html
http://www.talkandroid.com/android-sdk-install-guide/
http://developer.android.com/guide/topics/fundamentals.html
http://developer.android.com/resources/tutorials/hello-world.html
http://developer.android.com/resources/tutorials/notepad/index.html


No comments:

Post a Comment