[Tutorial] Smart List Adapters - Singleton Observable Lists

Tutorials with advanced 'difficulty' and more Lines of Code.

Do you think this changes how you will develop applications?

No votes
Are you kidding? Don't waste my time with your tomfoolery!
No votes
Total votes : 5

[Tutorial] Smart List Adapters - Singleton Observable Lists

Postby androidworkz » Sat Aug 14, 2010 1:05 pm

I have been working with Lists alot lately. I needed a better way to handle them in my application so that I didn't end up duplicating as much code as I had been just to manage these lists. The answer I came up with has actually helped me across the board... way beyond lists. It has turned my app into a collection of self aware objects that know when their values have changed and can inform any consuming objects that they need to update. What magic could provide me with this super power? Observable and Observer. I have placed the complete tutorial on my blog. See: Smart List Adapter Tutorial – Singleton Observable List Objects and how they can improve your app.

I hope that this tutorial opens your mind to just how powerful Observable Singleton objects are... and how they can completely change how your apps are written. These objects have changed how I think about my complete development methodology in the sense that I now have a vehicle to share intelligent objects between activities AND save complex application state without having to use voodoo. I have named the tutorial "Smart List Adapters"... but in reality, this actually changes the design of my applications across the board. Here is why. How many times have you wanted to save state of complex objects without having to create Parcelable objects to save in Bundles? How many times have you needed to share an object between multiple activities but maintain the state of the object at all times. I haven't seen any tutorials on the web that do what this one does... and I hope that it will help change the development paradigm for the average Android developer. I hope that this will have the same impact on your development adventure that it has had on mine. Granted, Singletons are not a new idea... however, I haven't seen their application used like this in the literally thousands of examples I have looked at for Android development and there are so many questions from developers about how to save state during the life cycle (orientation changes in particular) and how to pass complex objects between activities that I can't even begin to think that this design idea wouldn't help most Android developers from novice to advanced to create better applications. Let me know what you think.

Beyond Smart Lists - How Observable Singleton objects change the game

I have put together an example to show you how Smart Lists work... you should visit the link above to get the basic idea of how this works. Here I will show you the super power that this can provide to your applications. I don't think I will ever need to pass data using an Intent ever again... Let's take the example above and make 2 activities that both use the same Smart List object to show proof of concept. My example application has almost identical Activities (for simplicity) that we will switch between using a TabHost. You can download the complete Eclipse project below.
(78.15 KiB) Downloaded 307 times
Posts: 9
Joined: Tue Jun 01, 2010 9:32 pm


Re: [Tutorial] Smart List Adapters - Singleton Observable Li

Postby Mike.Adams » Fri Mar 18, 2011 7:11 pm

thanks for the example
Hi I'm Mike. Checkout my source code, projects and work here and let me know what you think.

Feel free to also upload and submit your code/projects there for all to see and find!
Posts: 26
Joined: Mon Mar 07, 2011 9:19 pm
Location: New York


Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests