2

こんにちは私はプログレスバーの更新に問題があります。

まず、テキストビューとプログレスバーを使用して各アイテムの行を作成するカスタムアダプターがあります。(各行のレイアウトを定義するitem_row.xmlがあります)

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);

これで、外部APIからバックグラウンドデータをダウンロードするサービスがあり、ダウンロードの進行状況に応じてプログレスバーを毎秒更新するタイミングが必要です。

そのために、ハンドラーで作成されたタイマータスクがあります(参照

しかし、問題は、進行状況を更新するために、アダプターで作成された進行状況バーに再度アクセスするにはどうすればよいですか?

ありがとう

4

1 に答える 1

1

簡単なはずです;)

ProgressBar pb = (ProgressBar)((View)list.getChildAt(i)).findViewById(R.id. downloadprogress);
于 2010-02-27T16:25:28.507 に答える