getView from CustomizedAdapter called several times

by Ola Ingvaldsen » Thu, 23 Jul 2009 16:20:32 GMT

Sponsored Links
  am having the same problem. In my case it only happens if I specify my own
layout using setContentView in onCreate() of my ListActivity. If i use the
standard layout i get correct number of calls to getView.

The thing is that if I have 5 items in my list i suspect the first 5 calls
to getView to have convertView=null each time. But its not. First time its
null, then the next 5 calls have the same convertView as the previous call
and then 5 more calls where the convertView is null. So the first 6 calls
to getView only results in changing the first element 5 times more than
whats necessary. After the 5 first calls the convertView is null and the
rest of the items in the list are filled out correctly. But when i scroll
down the list, we have 10 more calls again.

Does anybody have an idea whats wrong? Or how it can be avoided?

I have no weights in my layout at all. Its just a simple textView with a
status message and a listView.


On Wed, Jul 15, 2009 at 4:05 PM, Streets Of Boston


getView from CustomizedAdapter called several times

by Romain Guy » Thu, 03 Sep 2009 00:02:37 GMT

 here's nothing wrong with this, it can (and it will in some
situations) happen. getView() is not guaranteed to be called exactly
once per item. It happens for instance when you set the list/grid with
a height=wrap_content.

On Wed, Sep 2, 2009 at 5:32 AM, Guitou<> wrote:

Romain Guy
Android framework engineer

Note: please don't send private questions to me, as I don't have time
to provide private support. All such questions should be posted on
public forums, where I and others can see and answer them


Sponsored Links

Other Threads

1. onCreate() vs class variable initializers

It seems that many actions can be performed in either the onCreate()
method for an activity or in the variable initializer section at the
beginning of the class definition.  For example,  I could write:

     public class Main extends Activity {
        private Handler handler = new Handler();
        . . .

or I could write:

     public class Main extends Activity {
        private Handler handler;

     public void onCreate(Bundle savedInstanceState)
         handler = new Handler();
         . . .

What are the considerations that would make me want to do the
initialization in one place rather than the other?  Both forms of
initialization happen exactly once whenever the class is instantiated,
right?  And the variable initializers at the top happen before the
code in onCreate() is run.  But are there any other considerations as
to where I should initialize values for variables?


2. How to get this information (In this picture) to TextView on Android ?
I don't want a list of permission. I want a list of detail permission.
Please show example for me.


3. Magnetic Sensor

4. [WTA] : Disable Themes ADW

5. JUnit test case blocking main UI thread for AsyncTask

6. How to initialize visibly "gone" UI elements?

7. Proper way of launching Activity from Notification or Widget