TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nandhini Jayachandran
NA
117
43.8k
adapter in android
Oct 16 2014 8:18 AM
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
Reply
Answers (
1
)
Designing
Android