Better Understanding SimpleAdapter ViewBinder

I have 4 TextViews, 2 ImageViews, 2, Buttonsand 2 widgets that are part of the string definition in ListView. The data comes from XML and SimpleAdapter. To access these TextViews, I implement ViewBinder in a user class and override setViewValue. This works, and the two TextViewsthat I want to dynamically change are processed in setViewValue. What scares me is that my other two text elements don't go through setViewValue. I am talking about this based on setting a breakpoint where the thread of execution is only entered twice. Did I expect to see this 4 or more times?

That setViewValue's where I have a breakpoint.

@Override     
public boolean setViewValue(View view, Object data, String text)
{
    if(view.getId() == R.id.txtvw1)
    {             
//blah do some stuff
    }
    else if (view.getId() == R.id.txtvw2)
    {
//Blah do some stuff
    }

    return true;
} 

Xml declaration TextViews(1 shows and 4 not):

<TextView
        android:id="@+id/txtvw1"
        android:layout_centerHorizontal="true"
        android:layout_width="185dp"
        android:layout_height="25dp"
        android:textSize="20sp"
        android:layout_marginTop="60dp"
        android:gravity="center"
        android:inputType="none"
        android:text="@string/str_StaticA"
        android:textColor="#C0F700" />

    <TextView
        android:id="@+id/txtvw4"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="35dp"
        android:layout_width="95dp"
        android:layout_height="50dp"
        android:textSize="18dp"
        android:layout_marginTop="110dp"
        android:gravity="center"
        android:inputType="none"
        android:text="IMHO:"
        android:textColor="#FFBA19" />

, , , , , ?

. - View ListView XML ViewBinder, ! , , ViewBinder DataAdapter setViewBinder. , DataAdapter , , , . .

, , , DataAdapter:

String[] from = new String[] {"txtvw_PrevLift", "txtvw_PrevReps", "ActuLiftPikr", "ActulRepsPikr" };
int[] to = {R.id.txtvw_PrevLift, R.id.txtvw_PrevReps, R.id.ActuLiftPikr, R.id.ActulRepsPikr };

LiftDataAdapter LiftDataAdapter = new LiftDataAdapter(this, LiftDataMaps, R.layout.liftdatalayout, from, to);

, , , , . , .

+5
1

ViewBinder SimpleAdapter , Views, ( to ), ViewBinder setViewValue() , . setViewValue true, , View ( - ), ( TextView), Hashmap. setViewValue - TextViews ( ), true , . setViewValue Views , setViewValue, ( Views) return true ( , , View ). SimpleAdapter.bindView , ViewBinder.

, , , , SimpleAdapter ( )

+5

All Articles