Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show progress bar in each listview item?

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.

like image 673
Suyog Nikam Avatar asked Dec 27 '13 06:12

Suyog Nikam


2 Answers

Check out the Listview with ProgressBar it might help you.

like image 124
GrIsHu Avatar answered Nov 04 '22 06:11

GrIsHu


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

like image 30
vipul mittal Avatar answered Nov 04 '22 07:11

vipul mittal