Ok, here is the code...

No. even when I implement row recycling (or even the holder pattern, not
shown) it doesn't seem
to make any difference to the problem: when I call setText() on the row the
row doesn't get updated
with the text... I can't figure out why the text in the other textboxes is
not updating. I can
see all the good System.out.println statements (which could have been Log.d
but makes no
difference). It's like I'm updating something off the screen:

private class HelloAdapter extends BaseAdapter {

    // ...

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      View row = convertView;

      if (row == null) {

        LayoutInflater inflater = getLayoutInflater();

        row = inflater.inflate(R.layout.hello_item, parent, false);

      }

      EditText fooNoteEditText = (EditText) row.findViewById(R.id.fooNote);

      HelloItem helloItem = getItem(position);

      fooNoteEditText.setText(helloItem.group.fooNote);

      fooNoteEditText.addTextChangedListener(new
GlobalNoteTextWatcher(position));

      fooNotesList.add(position, fooNoteEditText);

      return row;

    }

  }

private class HelloAdapter extends BaseAdapter {

    ArrayList<EditText> fooNotesList = new ArrayList<EditText>();

    // ...

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      View row = convertView;

      if (row == null) {

        LayoutInflater inflater = getLayoutInflater();

        row = inflater.inflate(R.layout.hello_item, parent, false);

      }

      EditText fooNoteEditText = (EditText) row.findViewById(R.id.fooNote);

      HelloItem helloItem = getItem(position);

      fooNoteEditText.setText(helloItem.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.hello.items.get(position).group.fooNote = s.toString();

      // ((HelloAdapter) listView.getAdapter()).notifyDataSetChanged();

      String groupName = Globals.hello.items.get(position).group.name;

      for (int i = 0; i < Globals.hello.items.size(); i++)

        if (i != this.position) {

          HelloItem helloItem = Globals.hello.items.get(i);

          if (helloItem.group.name.compareTo(groupName) == 0) {

            lock = true;

            // helloItem.group.fooNote = s.toString();

            try {

              EditText fooNoteEditText = ((HelloAdapter)
listView.getAdapter()).fooNotesList.get(i);

              if (fooNoteEditText == null) {

                System.out.println("error");

              } else {

                System.out.println("no error");

              }

              if (fooNoteEditText != null) {

                // WHY IS THE TEXT TYPED IN THE OTHER TEXTBOX NOT UPDATING
HERE???

                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 [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

Reply via email to