I'm building an app that has a ListActivity and the view for each item has a progress bar. I've been able to bind my data to the TextView, but I can't seem to figure out how to bind it to the max and progress of the ProgressBar.
This is a simplified version of my view:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentLeft="true"/>
<ProgressBar android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/text1"
/>
</RelativeLayout>
and I'm using the same method as the Notepad tutorials to put my data into the views:
String[] from = new String[]{MyDbAdapter.KEY_AMOUNT};
int[] to = new int[]{R.id.text1};
SimpleCursorAdapter list_adapter =
new SimpleCursorAdapter(this, R.layout.item_row, myCursor, from, to);
setListAdapter(list_adapter);
Adding MyDbAdapter.KEY_AMOUNT and R.id.progress_bar to the arrays throws an exception (java.lang.IllegalStateException: android.widget.ProgressBar is not a view that can be bounds by this SimpleCursorAdapter). Is there some kind of @... that I need to use for max and progress to make this work?