Reputation: 127
please help me out to show the progress dialog in listview item.
public class DealerSubCatListAdapter extends BaseAdapter {
private Context context;
private ArrayList<Image> Image;
private LayoutInflater inflater = null;
public DealerSubCatListAdapter(Context context, ArrayList<Image> Image) {
this.context = context;
this.Image = Image;
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
notifyDataSetChanged();
}
@Override
public int getCount() {
return Image.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
if (convertView == null) {
view = inflater.inflate(R.layout.imagesubcat, null);
} else {
view = convertView;
}
TextView imagesubcat = (TextView) view.findViewById(R.id.imagesubcattv);
// tagLine
imagesubcat.setText(Image.get(position).image_type);
return view;
}
}
So, this is the adapter show the listview item.
Upvotes: 7
Views: 16695
Reputation: 21
the progress dialog should be shown somewhere you called this Adapter
Upvotes: 1
Reputation: 4691
If you really want to display progress bar in each item of listview ( although seems odd to me), you can declare a progress bar in R.layout.imagesubcat
XML tag for progress bar:
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
Upvotes: 1
Reputation: 17401
have a progress bar in R.layout.imagesubcat
and declare an array of integer for progress
int[] progress;
in constructor pass the progress array
now in getview
progressBar.setProgress(progress[position]);
whenever any progress changes just notify adapter
Upvotes: 2