If i type "Hello" in my edittext in activity 1 it will add "Hello" to the listview in activity 2 as the first entry ( which has no error ). Also, if I type "Apple" as my second entry I will change the first entry of "Hello" to "Apple" and add the new 2nd entry "Apple"... causing both entries to become "Apple" and "Apple"... any thoughts?

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_argue_list);

        ListView txtlist = (ListView)findViewById(android.R.id.list);


        Bundle bun = getIntent().getExtras();
         Lrg = bun.getString("Jenny");
         Med = bun.getString("Forest");
         Med2 = bun.getString("Gump");

            KoreyzAdapter add = new KoreyzAdapter();
            txtlist.setAdapter(add);
            list.add(0, Lrg);
            add.notifyDataSetChanged();
            setListAdapter(add);
    }
    class KoreyzAdapter extends ArrayAdapter<String>{

          public KoreyzAdapter() {
              super(ArgueListActivity.this, android.R.layout.simple_list_item_1, list);
        }
          class ViewHolder{
              TextView who;
              TextView sex;
              TextView cat;
              ImageView pic;

              ViewHolder(View v){
                  who = (TextView) v.findViewById(R.id.inputLrgtxt);
                  sex = (TextView) v.findViewById(R.id.whoMedtxt);
                  cat = (TextView) v.findViewById(R.id.stupidMedtxt);
                  pic = (ImageView)v.findViewById(R.id.sexpic);
              }

          }
                    public View getView(int position, View convertView, ViewGroup parent) {
                        View row = convertView;
                        ViewHolder holder = null;
                        if(row == null){

                             LayoutInflater inflator = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                            row = inflator.inflate(R.layout.list_item, parent, false);
                            holder = new ViewHolder(row);
                            row.setTag(holder);

                        }else{
                            holder = (ViewHolder)row.getTag();
                        }

                            holder.who.setText(Lrg);
                            holder.sex.setText(Med);
                            holder.cat.setText(Med2);

                            holder.pic.setImageResource(R.drawable.maleandfemale);

                            return row;
                        }

Recommended Answers

All 2 Replies

Can you post code for both activities? From above it is not clear what is happening inside app

Intent i = new Intent(this, ArgueListActivity.class);
         Bundle bun = new Bundle();
         bun.putString("Jenny", whatedit.getText().toString());
         bun.putString("Forest", sex.getSelectedItem().toString());
         bun.putString("Gump", cat.getSelectedItem().toString());
         i.putExtras(bun);
         whatedit.setText("");
         startActivity(i);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.