On Tue, Jul 13, 2010 at 9:19 PM, CodeFusion <[email protected]> wrote:
> My question is where should my ClickEvent handlers for those buttons be? > You're probably looking for something more concrete than "it depends" and "it's up to you", but that's probably how it's going to go since there is no context to the rest of your app and design. > Should I put them right in my custom view code since I have all the > information I need? > Sure, why not? If that's the easiest thing to do, just do it. > Should I start an ASyncTask that deletes the item and updates the adapter > data and calls onDataSetChanged() etc? > Are your operations taking that long? If not AsyncTask might be overkill ... > Should all of this be bubbled up through events to my ListActivity? > Sounds needlessly complicated. > I could probably make it work at any level, but at what level along this > hierarchy (Activity >ListView->Adapter->ListItemView) is the proper place to > edit/delete backing data for the ListView? > Given that the adapter is responsible for the data supplied to the ListView, I tend to give it more responsibility as far as adding / deleting / altering said data. That way it can control refreshing itself as necessary and it give other classes a simpler interface to deal with than, say, getting the adapter, getting it's data, modifying it, then calling notifyingDataSetChanged(). ------------------------------------------------------------------------------------------------- TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

