I have a list with a complex layout R.layout.menu_row
. It consists of a ProgressBar
and a text field. The adapter I use:
SimpleAdapter simpleAdapter = new SimpleAdapter(this, getData(path),
R.layout.menu_row, new String[] { "title", "progress" },
new int[] { R.id.text1,R.id.progressBar1});
The adapter knows how to handle TextViews
by it self but not ProgressBars
, so I wrote a complex data binder:
SimpleAdapter.ViewBinder viewBinder = new SimpleAdapter.ViewBinder() {
@Override
public boolean setViewValue(View view, Object data, String textRepresentation) {
//here goes the code
if () {
return true;
}
return false;
}
Now I'm stuck filling the mapping inside the function. I need to set the value of string progress
to the setProgress
method of the ProgressBar
. But I don't get a handle to string progress
and to the ProgressBar
.
You need to find out if the
ViewBinder
is called for theProgressBar
and set its progress(from thedata
parameter(the data from columnprogress
in your case)):EDIT : I've seen in your
addItem
method that you do:I think what you should set here is the
progress
parameter:Then in the
ViewBinder
: