как обновить GridView
в моем коде, когда я использовал этот код cla.notifyDataSetChanged
; скажем, не может решить, как добавить метод notifyDataSetChanged
в мой класс адаптера? пожалуйста, помогите мне, что вы делаете? мой класс адаптера не notifyDataSetChange
методКак добавить метод notifyDataSetChanged в базовом адаптере
public class fifthscreen extends Activity {
private AQuery androidAQuery;
CategoryListAdapter3 cla;
androidAQuery = new AQuery(this);
static ArrayList<String> Category_name = new ArrayList<String>();
static ArrayList<String> Category_image = new ArrayList<String>();
cla = new CategoryListAdapter3(fifthscreen.this);
gidView.setAdapter(cla);
адаптер класса
public class CategoryListAdapter3 extends BaseAdapter {
private Activity activity;
private AQuery androidAQuery;
public CategoryListAdapter3(Activity act) {
this.activity = act;
// imageLoader = new ImageLoader(act);
}
public int getCount() {
// TODO Auto-generated method stub
return fifthscreen.Category_ID.size();
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder;
androidAQuery = new AQuery(getcontext());
if(convertView == null){
LayoutInflater inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.viewitem2, null);
holder = new ViewHolder();
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
holder.txtText = (TextView) convertView.findViewById(R.id.title2);
holder.imgThumb = (ImageView) convertView.findViewById(R.id.image2);
holder.txtText.setText(fifthscreen.Category_name.get(position));
androidAQuery.id(holder.imgThumb).image(fifthscreen.Category_image.get(position), true,true);
return convertView;
}
private Activity getcontext() {
// TODO Auto-generated method stub
return null;
}
static class ViewHolder {
TextView txtText;
ImageView imgThumb;
}
}
cla.notifyDataSetChanged() верен. Какая у вас ошибка? –
где я размещаю эту строку? перед этой строкой listview.setAdapter (cla); или после этой строки? – user2914381
где i place cla.notifyDataSetChanged() перед gridView.setAdapter (cla); или после gridView.setAdapter (cla); – user2914381