Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CustomAdapter cusAdapter = new CustomAdapter(
					ManageYourAccountActivity.this, R.layout.manage_your_account_exist,
				name);
			view.setAdapter(cusAdapter);

i setting adapter in this format

My Custom adapter
public class CustomAdapter extends ArrayAdapter<GetAllDatas>{
	
	Context con;
	GetAllDatas gAD;
	private int viewResourceId;
	private int condition;
	ArrayList<GetAllDatas> names;
/*	ArrayList<String> h;*/
	
	

	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 headlineView;
		TextView reporterNameView;
		//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(viewResourceId, 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);
				
				gAD = names.get(position);
				if(gAD != null){
					
					holder.headlineView.setText(gAD.getPrice());
					holder.reporterNameView.setText(gAD.getDescription());
				}
		 }
				
//			} else {
//				holder = (ViewHolder) convertView.getTag();
//			}
		 
		/*	holder.headlineView.setText(names.get(position).getPrice());
			holder.reporterNameView.setText("By, "+position+names.get(position).getDescription());
			//holder.reportedDateView.setText(listData.get(position).getDate());
*/
			
		 
		 	return convertView;
		}

	
		
	

		public int getCount() {
			return names.size();
		}

		@Override
		public GetAllDatas getItem(int position) {
			return names.get(position);
		}

		@Override
		public long getItemId(int position) {
			return position;
		}


}

only last set of values in array is getting displayed .Using debug i found 88 set of values i got .I dnt know whats problem
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900