Re: [android-developers] Re: Looking for a design tip/advice/doc
On Tue, Aug 3, 2010 at 5:00 PM, bruce palant...@gmail.com wrote: If you are just doing a few items, it's not going to be a big deal. Same with grabbing data from a database. It's an issue when you have to scroll through lots of data and repopulate views, deal with flings, etc., while maintaining good speed. Sounds like you won't have to deal with this. Another way to approach this is to work with something like SimpleCursorAdapter and map your database onto the layout so it automagically populates. This only makes sense if you are going to display a set of info; lists/grid. In fact, I'm already using a SimpleCursorAdapter for a Spinner in the same Activity to improve the user experience. The Activity has a Gallery/ListView (while portrait or landscape), a Spinner for the selected ImageView from the Gallery/ListView, so the user has the posibility to go across the whole list, or just pick one within the Spinner. The ImageView shows you an image that could be interesting but maybe you don't know it. And the Spinner shows you a name, that maybe you are familiar with. So, you have the possibility of choose that. This two widgets are connected each other in terms that selecting something in the Spinner will select something in the Gallery/ListView and that will update 5 TextViews. For instance, only I have 12 rows of things to pick, but it could be more. Also, picking just one will expand more information about that row. Basically, it's a tour app, that has tours, that each tour has interest points. I know that google has recently create something like city tour, but it's not quite the same. And, I need to send another mail with a different topic to this list about some weird issues i'm facing with ListView. Thanks for the recommendations, Regards, -- If you want freedom, compile the source. Sebastián Treu http://labombiya.com.ar -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Looking for a design tip/advice/doc
If you are just doing a few items, it's not going to be a big deal. Same with grabbing data from a database. It's an issue when you have to scroll through lots of data and repopulate views, deal with flings, etc., while maintaining good speed. Sounds like you won't have to deal with this. Another way to approach this is to work with something like SimpleCursorAdapter and map your database onto the layout so it automagically populates. This only makes sense if you are going to display a set of info; lists/grid. Cheers On Aug 2, 10:11 am, Sebastián Treu sebastian.t...@gmail.com wrote: Hi all, I'm kind of new to android development. I have read from many sources that findViewById() is a costly operation. I'm making an application that deals with 5 TextViews to provide different kinds of information (distance, duration, title, description, etc) from a database. I'm using listeners to catch touch/click events and feedbacks a handler. The main function of the handler is to received a position in the Cursor where the new information needs to be displayed. I mentioned earlier that findViewById() is a costly operation. So, I don't call this method in the handler. Doing so, it will retrieve every time the Views when user touchs/clicks some widget. Is it right to populate the Activity with private members of the Views/Layout it displays? I mean, I don't like it. I don't know why, but seems that I'm populating too much the activity. I'm aware of the android:onClick xml attribute, but in my case I also use long click listeners. So, a piece of onCreate() looks like: imageTitle = (TextView)findViewById(R.id.title_image_view); title = (TextView)findViewById(R.id.title; desc = (TextView)findViewById(R.id.desc); duration = (TextView)findViewById(R.id.duration); distance = (TextView)findViewById(R.id.distance); And all of those are private members, wihout mention the cursor.getColumnIndex() for each. I thought on implementing Handler.Callback and set on the Hanlder.Callback constructor implementer a View array or a View list or something, but I also need this objects later to set other listeners and setups. Is this right? I cannot think another way, as I need the reference to the object, and also the Cursor reference that the handler will move to the position provided and update the correspondent View. I will really appreciate either an advice or a useful link/info/doc to read in what concern in this kind of designs. What I do not like is that It looks like imperative programming filling the Activity with global variables. Thanks, -- If you want freedom, compile the source. Sebastián Treuhttp://labombiya.com.ar -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en