costobject value :000120 is changed to 000180
On Wed, Sep 12, 2012 at 5:23 PM, arun kumar <[email protected]> wrote: > Hello , am having acustom list view in that products are there .when i > click on that products it will be saved in the *Arraylist that arraylist * > are giving to the another custom list view .(for this listview remove > button will be there for corresponding row.) > > if i click on that remove then that corresponding value will be > deleted.Here am getting problem.when i click on remove image that > particular product items are deleting it going well up* 3 items *(suppose > this screen *contains for 3 product.*...but if the screen contains *5 or 6 > * products then if i removing the bottom product of the screen then the > values are *costobject* values are changing) > am attaching the scrren shots of it .... > > > > > > > public class MyApplication extends Application { > ArrayList<String> product = new ArrayList<String>(); > ArrayList<String> account = new ArrayList<String>(); > ArrayList<String> cost = new ArrayList<String>(); > ArrayList<String> input = new ArrayList<String>(); > String productdata,accountdata,costdata=null; > } > when i click the button the items are adding into the arraylist > > > app.product.add(app.productdata); > app.cost.add(app.costdata); > > app.account.add(app.accountdata); > > > > > > then the added arraylist values are setting to the custom listview > here the custom listview contains textview and remove button > corresponding.when remove image > > > > > adapter =new MyAdapter(this, app.product,app.account,app.cost); > listView.setAdapter(adapter); > } > > public class MyAdapter extends BaseAdapter { > > Context context = null; > ArrayList<String> items= null; > ArrayList<String> items1= null; > ArrayList<String> items2= null; > ArrayList<String> items3= null; > > public MyAdapter(CheckOut checkOut, ArrayList<String> items, > ArrayList<String> items1,ArrayList<String> items2,ArrayList<String> > items3 ) { > // TODO Auto-generated constructor stub > this.items = items; > this.items1 = items1; > this.items2 = items2;this.items3 = items3; > } > > public MyAdapter(OnClickListener onClickListener, ArrayList<String> items7, > ArrayList<String> items12, ArrayList<String> items22, > ArrayList<String> items32) { > // TODO Auto-generated constructor stub > } > > @Override > public int getCount() { > // TODO Auto-generated method stub > return items.size(); > } > > @Override > public Object getItem(int position) { > // TODO Auto-generated method stub > return items; > //return items.get(position); > } > > @Override > public long getItemId(int position) { > // TODO Auto-generated method stub > return 0; > } > > class ViewHolder > { > private View layout = null; > private TextView produ = null; > private TextView accon = null; > private TextView costob = null; > private TextView total,quantit = null; > ImageView remove,edit=null; > } > ViewHolder holder; > @Override > public View getView(final int position, View convertView, ViewGroup > parent) { > // TODO Auto-generated method stub > > > if (convertView == null) { > holder=new ViewHolder(); > > lay = LayoutInflater.from(getApplicationContext()); > convertView = lay.inflate(R.layout.customlist, null); > holder.accon = (TextView) convertView.findViewById(R.id.check14); > holder.costob = (TextView) convertView.findViewById(R.id.check15); > holder.produ = (TextView) convertView.findViewById(R.id.check11); > holder.remove = (ImageView) convertView.findViewById(R.id.check19); > convertView.setTag(holder); > } else { > holder =(ViewHolder) convertView.getTag(); > } > > holder.produ.setText("" +app.product.get(position)); > holder.costob.setText("Account :" + > app.account.get(position)); > holder.costob.setText("Cost Object :" + app.cost.get(position)); > > holder.remove.setOnClickListener(new OnClickListener() { > @Override > public void onClick(View v) { > // TODO Auto-generated method stub > try { > > // remove the values > app.product.remove(app.product.get(position)); > app.account.remove(app.account.get(position)); > app.cost.remove(app.cost.get(position)); > adapter.notifyDataSetChanged(); > // > } catch (IndexOutOfBoundsException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > catch (ConcurrentModificationException e) { > // TODO: handle exception > } > } > }); > > return convertView; > } > > > > > > > > > > > > > > > > > > > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

