tags:

views:

73

answers:

1

I'm trying to add a ProgressBar to my row.xml view but I can't seem to make it work I keep getting

06-09 12:44:44.802: ERROR/AndroidRuntime(1012): java.lang.IllegalStateException: android.widget.ProgressBar is not a  view that can be bounds by this SimpleAdapter

ArrayList arr = new ArrayList();
HashMap map = new HashMap();
map.put("progress", 10);
arr.add(map);

String [] fieldNames = {"progress"};
int [] fieldIds = {R.id.progress};

SimpleAdapter adapter = new SimpleAdapter(this, arr, R.layout.row, fieldNames, fieldIds);
list = (ListView) findViewById(R.id.list);
list.setAdapter(adapter);

<ProgressBar android:id="@+id/progress"
        style="?android:attr/progressBarStyleHorizontal"
        android:max="100"
        android:progress="5"        
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
    />

Does anyone have any idea what I'm missing?

+1  A: 

SimpleAdapter does not know how to deal with a ProgressBar. Moreover, a ProgressBar by itself will be a truly awful list row.

Please put the ProgressBar inside of some larger row layout (with a label and such). You will also need to create your own adapter class that will know how to bind data to a ProgressBar.

CommonsWare
Thanks. I made my own by extending base adapter.
lemon