[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-08-05 Thread jsdf
On Jun 27, 12:56 am, Peter wrote: > > There's not a default number of views created for an adapter. Alist > > creates as many views as it needs to fill the screen. Views get reused > > only when you start scrolling or when the adapter send a > > notifyDatasetChanged(). You say you have a thread

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-07-30 Thread xml gock
er... On 6月30日, 下午10时40分, Streets Of Boston wrote: > Your code in your getView implementation of the adapter looks good at > first sight. The structure of this method looks good. > > I think there are a few issues though. > > In your getView(...) method, you access the variable 'appList': > >

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-07-30 Thread xml gock
Hi, I have just encountered this promblem and solved it ! Just delete "if (convertView==null)".. you may have a try! Good luck On 6月30日, 下午12时51分, Romain Guy wrote: > Do not inflate a new view every time, not only is it less efficient > but it can make your application run out of memory if the u

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-30 Thread Streets Of Boston
Your code in your getView implementation of the adapter looks good at first sight. The structure of this method looks good. I think there are a few issues though. In your getView(...) method, you access the variable 'appList': if (position >= appList.size()) {

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-29 Thread Romain Guy
Do not inflate a new view every time, not only is it less efficient but it can make your application run out of memory if the user scrolls for a while. It is a very poor way to work around whatever bug you have in your adapter. On Mon, Jun 29, 2009 at 9:43 PM, Peter wrote: > > Doug, you were righ

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-29 Thread Peter
Doug, you were right. If I inflate a new view each time instead of using the cached convertView, the images never show incorrectly. This is obviously less efficient, but it's right. I need to look more closely to see if I was abusing the ViewHolder pattern, but I don't see how I was. This is wha

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-27 Thread Doug
Have you tried *not* caching the component views in your ViewHolder object - instead looking them up whenever you get a redraw request? You may find that the list is re-using objects, and your image issue is simply an artifact of that. Doug On Jun 26, 10:56 pm, Peter wrote: > > There's not a def

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Peter
> There's not a default number of views created for an adapter. A list > creates as many views as it needs to fill the screen. Views get reused > only when you start scrolling or when the adapter send a > notifyDatasetChanged(). You say you have a thread updating the data, > what is exactly that t

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Doug
Maybe related, maybe not... I use a CursorAdapter to update a list - whenever the list refreshes (due to the database changing) the 'onBindView()' for a given position always seems to deliver me a *different* view from the one that originally contained the list item. So, during the update at lea

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Romain Guy
> How many views are created by default for an adapter? My guess is 3 > based on what I see. Then, when getView() gets to index 4, 5, or 6, it > correctly creates more Views and populates the right data. Anyone ever > seen anything like this? There's not a default number of views created for an a

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Peter
On Jun 26, 5:59 pm, Mark Murphy wrote: > Peter wrote: > > Sorry. I'm making the mistake of hoping people identify the problem > > based on not very much information, partially because I'm lazy, I > > guess. > > I may also simply be a bit thick. > > > Row 0 in the ListView contains an ImageView.

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Peter
I agree with your comments, and have made attempts to do so. I use a message handler to update the items. Actually, I never even modify the List that the adapter has. I modify values in a Map that is initiated with the List items as the Map's values. Then, knowing the key, I update the Map item's

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Mark Murphy
Peter wrote: > Sorry. I'm making the mistake of hoping people identify the problem > based on not very much information, partially because I'm lazy, I > guess. I may also simply be a bit thick. > Row 0 in the ListView contains an ImageView. Initially, all rows have > a placeholder image. The thr

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Dianne Hackborn
The first thing I would suggest is to not touch anything related to the view hierarchy from another thread. It is really hard to know what all your thread is doing and what problems it might be having, so I would first want to see that potential issue eliminated from the equation. Instead, have i

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Peter
See my comments inline that should give you a better description and slightly more information. Thank you. On Jun 26, 4:43 pm, Mark Murphy wrote: > Peter wrote: > > I've tried to describe this problem a few times, but I'll try again. > > I saw your earlier posts. I could not make heads or tails

[android-developers] Re: Default number of Views constructed for a BaseAdapter?

2009-06-26 Thread Mark Murphy
Peter wrote: > I've tried to describe this problem a few times, but I'll try again. I saw your earlier posts. I could not make heads or tails of them then, and I'm not having much better luck here. > However, when 0 is updated, 5 mirrors its data on the screen > briefly What, exactly, is "its"