Hi,

I'm facing following problem. I have a layout, which is inflated
inside an adapter (extended BaseAdapter). The layout consists of
TextView, EditText and of two buttons (Save and Delete). This group is
for each item in database and then it's listed one by one, so it
means, on screen there can be several groups of these widgets.

The point is, how to access the content of the EditText in the group
when I press the button Save? I've tried to put setTag() on EditText
and Save button:

...
public View getView(...) {
...
contentEditText = (EditText) v.findViewById(R.id.ContentEditText);
contentEditText.setTag("EditText" + mIds.get(position));

editBtn.setTag(mIds.get(position));
editBtn.setOnClickListener(editBtnListener);
}

and then in the listener to access the EditText via findViewWithTag:

private OnClickListener editBtnListener = new OnClickListener() {
        public void onClick(final View v) {
                logger.LogInfo("EDIT_BTN onClickListener(): " + v.getTag());
                EditText tmp = (EditText)
v.findViewWithTag("EditText"+v.getTag());
    }
};

The first line
                logger.LogInfo("EDIT_BTN onClickListener(): " + v.getTag());
return the correct Tag for the pressed button (first, second row,
etc.)

Unfortunately,
the second line where I'm trying to get the EditText object, the tmp
object is null, so, the object is not found with the findViewWithTag
method...


Any idea how to solve this or maybe to use another approach in this
situation?

Thanks
Frankie

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