I don't mean to shift gears here on you, but you are putting these EditTexts in a ListView and you may not even need the ListView.
A ListView is usually not edited in place and actually are very friendly when you try to. Are you planning on having a lot of these edit boxes? It might be better just to use a LinearLayout wrapped in a ScrollView and dynamically add EditText to the LinearLayout assigning different IDs as you go. That way you can access those at any time and you won't have to fight with the ListView. I know people don't like to share ideas for programs, but can you explain a little more why you would have so many edit in place boxes that you need a ListView? Steven Studio LFP http://www.studio-lfp.com On Wednesday, September 28, 2011 2:46:17 PM UTC-5, John Goche wrote: > > > I see, my code post got list somehow, I've tried to simplify it a bit, here > it is: > > Still trying to figure out why the text edits won't update... > > private class BarAdapter extends BaseAdapter { > > ArrayList<EditText> globalNotesList = new ArrayList<EditText>(); > > @Override > public int getCount() { > > return Globals.bar.items.size(); > > } > > @Override > public long getItemId(int position) { > > return position; > > } > > @Override > public BarItem getItem(int position) { > > return Globals.bar.items.get(position); > > } > > > @Override > public View getView(int position, View convertView, ViewGroup parent) { > > View row = convertView; > > if (row == null) { > > LayoutInflater inflater = getLayoutInflater(); > > row = inflater.inflate(R.layout.bar_item, parent, false); > > } > > EditText fooNoteEditText = (EditText) row.findViewById(R.id.fooNote); > > BarItem barItem = getItem(position); > > fooNoteEditText.setText(barItem.group.fooNote); > > fooNoteEditText.addTextChangedListener(new > FooNoteTextWatcher(position)); > > fooNotesList.add(position, fooNoteEditText); > > return row; > > } > > } > > static boolean lock = false; > > class FooNoteTextWatcher implements TextWatcher { > > > FooNoteTextWatcher(int position) { > > this.position = position; > > } > > @Override > public void afterTextChanged(Editable s) { > > if (lock) > return; > > Globals.bar.items.get(position).group.fooNote = s.toString(); > > // ((BarAdapter) listView.getAdapter()).notifyDataSetChanged(); > > String groupName = Globals.bar.items.get(position).group.name; > > for (int i = 0; i < Globals.bar.items.size(); i++) > > if (i != this.position) { > > BarItem barItem = Globals.bar.items.get(i); > > if (barItem.group.name.compareTo(groupName) == 0) { > > lock = true; > > // barItem.group.fooNote = s.toString(); > > try { > > EditText fooNoteEditText = ((BarAdapter) > listView.getAdapter()).fooNotesList.get(i); > > if (fooNoteEditText == null) { > > System.out.println("error"); > > } else { > > System.out.println("no error"); > > } > > if (fooNoteEditText != null) { > > // WE GET HERE, WHY IS SetText NOT SETTING THE TEXT??? > > fooNoteEditText.setText(s.toString()); > fooNoteEditText.postInvalidate(); > System.out.println("Success!!!"); > System.out.println(i); > System.out.println(s.toString()); > > } > > } catch (Exception e) { > System.out.println(e); > } > > lock = false; > > } > > } > > } > > @Override > public void beforeTextChanged(CharSequence s, int start, int count, int > after) { > > } > > @Override > public void onTextChanged(CharSequence s, int start, int before, int > count) { > > } > > private int position; > > } > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en