1
Answer

adapter in android

Only last value getting displayed inadapter 
 
 
ublic class CustomAdapter extends ArrayAdapter<GetAllDatas>{
Context con;
//ArrayList<GetAllDatas> gAD;
private int viewResourceId;
private int condition;
ArrayList<GetAllDatas> names;
public CustomAdapter(ManageYourAccountActivity context,
int resourceId, ArrayList<GetAllDatas> name) {
super(context, resourceId, name);
this.con = context;
this.names = name;
this.viewResourceId = resourceId;
this.condition=condition;
/*gAD = new ArrayList<GetAllDatas>();
gAD.addAll(name);*/
}
/*private class ViewHolder {
ImageView bitmapimage;
TextView txtName;
TextView txtDate;
TextView txtSize;
}*/
@Override
public View getView(int position, View convertView, ViewGroup parent){
//ViewHolder holder = null;
// Bitmap loadBitmap=null;
ViewHolder holder;
System.gc();
LayoutInflater mInflater = (LayoutInflater) con
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.manage_your_account_exist, null);
holder = new ViewHolder();
holder.headlineView = (TextView) convertView.findViewById(R.id.txtprice1);
holder.reporterNameView = (TextView) convertView.findViewById(R.id.txtdesc1);
// holder.reportedDateView = (TextView) convertView.findViewById(R.id.date);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.headlineView.setText(names.get(position).getPrice());
holder.reporterNameView.setText("By, "+i+names.get(position).getDescription());
//holder.reportedDateView.setText(listData.get(position).getDate());
return convertView;
}
static class ViewHolder {
TextView headlineView;
TextView reporterNameView;
// TextView reportedDateView;
}
public int getCount() {
return names.size();
}
@Override
public GetAllDatas getItem(int position) {
return names.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
}
I dnt know where is the error ?using debug i am getting values  
 

Answers (1)
Next Recommended Forum