When traying to do a good design for an Android app, I ussually face a problem when trying to get some balance between clarity and efficiency, maybe is a silly situation but for example, let's take a simple shopping list app:
I can have a really readable model based on two classes: FoodItem and ShoppingList, where FoodItem represents each item that can be in the shopping list containing its fields (name, description, price, etc...) and the ShoppingList item just keeps a list of FoodItems objects and some extra fields (i.e: totalPrice, etc...).
Ok, now I'm putting an ActivityList for showing and managing my shopping list with a custom layout for showing FoodItem's data. The simplest way I've found to load list is using a SimpleListAdapter, which needs to receive a Map containing the fields of the FoodItem I want to show in the list, then... what's the best option? Having a method like "toMap" in my FoodItem class and, consequently another similar method "toMapsList" in my ShoppingList class to translate my list of objects to a list of Maps? or is there any other option?
This doesn't seem to be a good solution from the point of view of efficiency. It seems it would be better to take off from the model and work just with Maps the whole way.
I don't know if there's a proper way to keep a clean model in an Android app withouth having to do things like convertir objects to Maps.
Any good solution?
Thanks! :)
-- You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment