views:

342

answers:

1

Hi i have a problem updating a progress bar.

First i have a custom adapter in which i create a row for each item with a textview and a progress bar. (i have a item_row.xml in where i define the layout for each row)

public View getView(int position, View convertView, ViewGroup parent) { 
.....
     ProgressBar progressHorizontal = (ProgressBar)tripListItemView.findViewById(R.id.downloadprogress);
        if (offline) {
            progressHorizontal.setVisibility(View.VISIBLE);
            progressHorizontal.setProgress(t.getDownloaded());
        } else
            progressHorizontal.setVisibility(View.INVISIBLE);

        TextView itemName  =(TextView)tripListItemView.findViewById(R.id.tripsname);

Ok, now i have a service downloading in background data from an external API, and i want when to update the progress bar every second with the progress of the download.

For that, i have a timer task made with a handler (reference)

but the problem is how can i access again to the progress bars created in my adapter in order to update the progress?

Thanks

A: 

It should be easy ;)

ProgressBar pb = (ProgressBar)((View)list.getChildAt(i)).findViewById(R.id. downloadprogress);
skyman