グリッドビューにいくつかの画像を表示するためのカスタム アダプターがあります。
public class CustomAdapter extends BaseAdapter {
private Context context;
ArrayList<String> list = null;
public CustomAdapter (Context context, ArrayList<String> list) {
this.context = context;
this.list = list;
}
l
public int getCount() {
return list.size();
}
public Object getItem(int paramInt) {
return paramInt;
}
public long getItemId(int paramInt) {
return paramInt;
}
public View getView(int position, View child, ViewGroup parent) {
String string= list.get(position);
Bitmap bitmap = null;
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.grid_item, null);
RelativeLayout parentLayout = (RelativeLayout) view
.findViewById(R.id.parentLayout);
ImageView iView = (ImageView) view.findViewById(R.id.imageView);
final ProgressBar progress = (ProgressBar) view.findViewById(R.id.progress);
if (string != null) {
bitmap = BitmapFactory.decodeFile(string);
} else {
bitmap = BitmapFactory.decodeResource(context.getResources(),
R.drawable.img_loading);
}
iView.setImageBitmap(bitmap);
iView.setTag(position);
return view;
}
}
これは gridview 用のアダプターです。gridview アイテムを選択すると、対応するファイルがダウンロードされ、プログレスバーが表示されます。しかし、notifyDatasetChanged() を呼び出すと、プログレスバーは初期状態を保持します。
notifyDatasetChanged() が呼び出された場合でも、プログレスバーの状態/進行状況を保持/表示するにはどうすればよいですか?
ありがとう