0
Johan Nilsson  johan@markupartist.com  @johanni
 
STHLM Traveling http://markupartist.com/sthlmtraveling/
<ul><li>&quot;Att surfa till SLs hemsida funkar bättre&quot; </li></ul>&quot;Helt värdelös.&quot; &quot;Saknar bara realti...
Help the developer http://www.cyrket.com/package/com.xtralogic.android.logcollector
Search in one of Swedens largest liquor databases  iglaset.se  with comments and ratings.
<ul><ul><li>Demo  </li></ul></ul><ul><ul><li>Passing data between activities </li></ul></ul><ul><ul><li>Custom list adapte...
Demo  
Passing data between activities <ul><li>Non-Persistent Objects </li></ul><ul><ul><li>The android.app.Application class </l...
Using public static can get kinda messy, not that easy to call RouteDetailActivity from another activity <ul><li>/** </li>...
Primitive Data Types <ul><li>intent.putExtra(&quot;com.markupartist.iglaset.drinkId&quot;, drinkId); </li></ul>
Using Parcelable, we can send more complex objects <ul><li>http://github.com/johannilsson/iglaset/blob/master/src/com/mark...
List Adapters  
SectionedListAdapter Idea by Jeff Sharkey  http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09...
SectionedListAdapter
MultipleListAdapter http://github.com/johannilsson/sthlmtraveling/blob/master/src/com/markupartist/sthlmtraveling/Multiple...
MultipleListAdapter
Paginating Adapter http://github.com/johannilsson/iglaset/blob/master/src/com/markupartist/iglaset/activity/SearchResultAc...
Screen rotation When switching from portrait to landscape mode or vice-versa, the activity's onDestroy() and onCreate() wi...
onRetainNonConfigurationInstance @Override public Object onRetainNonConfigurationInstance() {     return mDrinks; }   @Ove...
onSaveInstanceState @Override protected void onSaveInstanceState(Bundle bundle) {     bundle.putParcelableArrayList(&quot;...
Some links <ul><ul><li>ImageLoader http://wu-media.com/2009/06/android-imageloader-load-images-sequencially-in-the-backgro...
Thank you [email_address] @johanni See you at the Android Hackathon at bwin 28/11
Upcoming SlideShare
Loading in...5
×

GTUG Android iglaset Presentation 1 Oct

1,020

Published on

Android iglaset slides from Stockolm GTUG presentation, October 1st

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,020
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • sdsdsdsd
  • Transcript of "GTUG Android iglaset Presentation 1 Oct"

    1. 1. Johan Nilsson  johan@markupartist.com @johanni
    2. 3. STHLM Traveling http://markupartist.com/sthlmtraveling/
    3. 4. <ul><li>&quot;Att surfa till SLs hemsida funkar bättre&quot; </li></ul>&quot;Helt värdelös.&quot; &quot;Saknar bara realtid. Grym annars&quot; &quot;Bra app men behövs bokmärken&quot; &quot;Eftersom programmet inte uppfyller mina basbehov så blir det en etta&quot; &quot;At last. SL mobile site is crummy on Android and this fills a nice gap. I am hoping for the ability to bookmark locations soon&quot;
    4. 5. Help the developer http://www.cyrket.com/package/com.xtralogic.android.logcollector
    5. 6. Search in one of Swedens largest liquor databases iglaset.se with comments and ratings.
    6. 7. <ul><ul><li>Demo </li></ul></ul><ul><ul><li>Passing data between activities </li></ul></ul><ul><ul><li>Custom list adapters </li></ul></ul><ul><ul><li>Handling screen rotation </li></ul></ul><ul><ul><li>Some links </li></ul></ul>
    7. 8. Demo  
    8. 9. Passing data between activities <ul><li>Non-Persistent Objects </li></ul><ul><ul><li>The android.app.Application class </li></ul></ul><ul><ul><li>A public static field/method </li></ul></ul><ul><ul><li>A HashMap of WeakReferences to Objects </li></ul></ul><ul><ul><li>A Singleton class </li></ul></ul><ul><li>  </li></ul><ul><li>Persistent Objects </li></ul><ul><li>  </li></ul><ul><ul><li>Application Preferences </li></ul></ul><ul><ul><li>Files </li></ul></ul><ul><ul><li>contentProviders </li></ul></ul><ul><ul><li>SQLite DB </li></ul></ul><ul><li>  </li></ul>http://developer.android.com/intl/zh-CN/guide/appendix/faq/framework.html#3
    9. 10. Using public static can get kinda messy, not that easy to call RouteDetailActivity from another activity <ul><li>/** </li></ul><ul><li>* Holds the current selected route, this is referenced by </li></ul><ul><li>* RouteDetailActivity. </li></ul><ul><li>*/ </li></ul><ul><li>public static Route route; </li></ul>
    10. 11. Primitive Data Types <ul><li>intent.putExtra(&quot;com.markupartist.iglaset.drinkId&quot;, drinkId); </li></ul>
    11. 12. Using Parcelable, we can send more complex objects <ul><li>http://github.com/johannilsson/iglaset/blob/master/src/com/markupartist/iglaset/provider/Drink.java#L9   </li></ul>intent.putExtra(&quot;com.markupartist.iglaset.drink&quot;, drink);  
    12. 13. List Adapters  
    13. 14. SectionedListAdapter Idea by Jeff Sharkey  http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/ Refactored version at http://github.com/commonsguy/cw-advandroid/blob/master/ListView/Sections/src/com/commonsware/android/listview/SectionedAdapter.java
    14. 15. SectionedListAdapter
    15. 16. MultipleListAdapter http://github.com/johannilsson/sthlmtraveling/blob/master/src/com/markupartist/sthlmtraveling/MultipleListAdapter.java mMultipleAdapter = new MultipleListAdapter(); mMultipleAdapter.addAdapter(ADAPTER_FIRST, mFirstAdater); mMultipleAdapter.addAdapter(ADAPTER_SECOND, mSecondAdapter); mMultipleAdapter.addAdapter(ADAPTER_THIRD, mThirdAdapter);
    16. 17. MultipleListAdapter
    17. 18. Paginating Adapter http://github.com/johannilsson/iglaset/blob/master/src/com/markupartist/iglaset/activity/SearchResultActivity.java#L161
    18. 19. Screen rotation When switching from portrait to landscape mode or vice-versa, the activity's onDestroy() and onCreate() will be called Rotate the emulator by pressing Ctrl + F12
    19. 20. onRetainNonConfigurationInstance @Override public Object onRetainNonConfigurationInstance() {     return mDrinks; }   @Override public void onCreate(Bundle savedInstanceState) {      final ArrayList<Drink> data = (ArrayList<Drink>)                                            getLastNonConfigurationInstance(); } <ul><ul><li>If it is expensive to serialize </li></ul></ul><ul><ul><li>If you can not serialize, network connections </li></ul></ul>
    20. 21. onSaveInstanceState @Override protected void onSaveInstanceState(Bundle bundle) {     bundle.putParcelableArrayList(&quot;drinks&quot;, mDrinks); } @Override public void onCreate(Bundle savedInstanceState) {     ArrayList<Drink> data = null;     if (savedInstanceState != null) {         data = savedInstanceState.getParcelableArrayList(&quot;drinks&quot;);     } } <ul><ul><li>If you need to save several objects </li></ul></ul><ul><li>  </li></ul><ul><li>Might also be called in other cases (when the activity is closed because of low memory) </li></ul>
    21. 22. Some links <ul><ul><li>ImageLoader http://wu-media.com/2009/06/android-imageloader-load-images-sequencially-in-the-background/ </li></ul></ul><ul><ul><li>Shelves http://code.google.com/p/shelves/ </li></ul></ul><ul><ul><li>CommonsWare http://commonsware.com/AdvAndroid/index.html   </li></ul></ul><ul><ul><li>Color debugging http://jsharkey.org/blog/2009/04/22/modifying-the-android-logcat-stream-for-full-color-debugging/ </li></ul></ul><ul><ul><li>Swedroid http://swedroid.se/   </li></ul></ul>
    22. 23. Thank you [email_address] @johanni See you at the Android Hackathon at bwin 28/11
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×