Re: [android-developers] need suggestion on how to create views at run time and efficiently
On Thu, Mar 18, 2010 at 10:47 AM, social hub shubem...@gmail.com wrote: Hi, I have a case where I have add to listview textview based on no of messages. 1) I am doing like this for(int i=0;i10;i++) { TextView tv=new TextView(context); linearlayout.add(tv); } Which is it, listview or linearlayout? I really like to know is there a better way to do than this way. is there a way to clone a textview and reuse it rather than inflating every time If you really want a list of items, you should be using a ListView, for which you can define an adapter that provides you with an existing View, if available, that you can reuse in the list instead of creating a new one each time. - 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 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
Re: [android-developers] need suggestion on how to create views at run time and efficiently
I am actually using Gallery and using base adapter. Inside base adpater getview I have to create runtime textviews. I may try to put a listview inside gallery getview do u think it will be useful and efficient than creating views at runtime as described below. Thanks On Thu, Mar 18, 2010 at 1:52 PM, TreKing treking...@gmail.com wrote: On Thu, Mar 18, 2010 at 10:47 AM, social hub shubem...@gmail.com wrote: Hi, I have a case where I have add to listview textview based on no of messages. 1) I am doing like this for(int i=0;i10;i++) { TextView tv=new TextView(context); linearlayout.add(tv); } Which is it, listview or linearlayout? I really like to know is there a better way to do than this way. is there a way to clone a textview and reuse it rather than inflating every time If you really want a list of items, you should be using a ListView, for which you can define an adapter that provides you with an existing View, if available, that you can reuse in the list instead of creating a new one each time. - 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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
Re: [android-developers] need suggestion on how to create views at run time and efficiently
On Thu, Mar 18, 2010 at 2:18 PM, social hub shubem...@gmail.com wrote: I am actually using Gallery and using base adapter. Inside base adpater getview I have to create runtime textviews. Wait, now it's a Gallery? LOL I may try to put a listview inside gallery getview do u think it will be useful and efficient than creating views at runtime as described below. I have no idea, I have not use a Gallery so I don't know how that works. Good luck. - 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 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: [android-developers] need suggestion on how to create views at run time and efficiently
similar to list view except it scrolls horizontally same functionality thats all On Thu, Mar 18, 2010 at 3:47 PM, TreKing treking...@gmail.com wrote: On Thu, Mar 18, 2010 at 2:18 PM, social hub shubem...@gmail.com wrote: I am actually using Gallery and using base adapter. Inside base adpater getview I have to create runtime textviews. Wait, now it's a Gallery? LOL I may try to put a listview inside gallery getview do u think it will be useful and efficient than creating views at runtime as described below. I have no idea, I have not use a Gallery so I don't know how that works. Good luck. - 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+ unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.