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.

-Ola

On Wed, Jul 15, 2009 at 4:05 PM, Streets Of Boston
<flyingdutc...@gmail.com>wrote:


--~--~---------~--~----~------------~-------~--~----~



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<drumsensati...@gmail.com> wrote:



--
Romain Guy
Android framework engineer
romain...@android.com

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. ProgressDialog BackGround

Hello All,
  I would like to know the possibilities of changing the background
Image/color of aProgressDialog?

  I already tried it with a class that extends ProgressDialog and
tried to set the background, but it did not do it for the whole
Dialog(Window), only the part that has the Message get painted and not
the Bigger Container(Title+Message).

  Here is the Code Snippet

                                           mDefaultDialog = new
Dialog(mContext);
                
mDefaultDialog.setContentView(R.layout.progress_dialog_background);
                mDefaultDialog.setTitle("Custom Dialog");
                TextView text = (TextView) 
mDefaultDialog.findViewById(R.id.text);
                text.setText("Hello, this is a custom dialog!");

     Layout file

                            <LinearLayout
                                            xmlns:android="http://
schemas.android.com/apk/res/android"
 
android:layout_width="fill_parent"
 
android:layout_height="fill_parent"
 
android:orientation="horizontal"
 
android:background="@drawable/red">
                               <TextView android:id="@+id/text"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:text="Details"
                        android:textColor="#FFF"
                        android:textAppearance="@style/ScreenTitle" />
                           </LinearLayout>


Regards
V. Ramkumar.

-- 

2. About ListView filter

Hi every one,
    i want to know how to filter list view that have an custom
adapter.




Thanks

-- 

3. Use of AIDL Interfaces for IPC with List of AIDL Interface

4. Retrieve "My contact card" data

5. Dynamically obtaining several instance of a view item defined in layout/xml file

6. MapView displays pages different than launching via ACTION_VIEW

7. how to delete groups in android 2.1