On ExpandableListView in child view present EditText "edName". After user change text in EditText, need a) update database b) refresh ExpandableListView group text on new text.
My idea is - after finish change text user change focus on next View element. On EditText lost focus i write to database and call notifyDataSetChanged();
addTextChangedListener not suitable, need respond after a set of text.
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, android.view.ViewGroup parent)
{
View view = super.getChildView(groupPosition, childPosition, isLastChild, convertView, parent);
final EditText edName = (EditText) view.findViewById(R.id.edName);
edName.setOnFocusChangeListener(new OnFocusChangeListener()
{
public void onFocusChange(View arg0, boolean focusable)
{
Log.e("Name", "Focusable: " + focusable + " CurValue: " + dataItem.Name + " ETValue: " + edName.getText().toString());
}
});
}
On View without ExpandableListView EditText lost focus after user touch another place from EditText, but on view with ExpandableListView
group expand:
10-25 22:52:44.390: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyy
10-25 22:52:44.390: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyy
touch on EditText:
10-25 22:54:18.072: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyy
10-25 22:54:18.092: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyy
10-25 22:54:18.642: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyy
10-25 22:54:18.662: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyy
type "u":
10-25 22:54:56.369: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyy
10-25 22:54:56.369: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyy
10-25 22:54:56.399: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyyu
10-25 22:54:56.409: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyyu
type "i":
10-25 22:56:05.557: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyyu
10-25 22:56:05.567: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyyu
10-25 22:56:05.657: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyyui
10-25 22:56:05.657: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyyui
touch another EditTest:
10-25 22:56:44.605: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyyui
10-25 22:56:44.665: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyyui
10-25 22:56:44.755: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyyui
10-25 22:56:44.755: E/Name(24403): Focusable: true CurValue: tytyy ETValue: tytyyui
10-25 22:56:46.787: E/Name(24403): Focusable: false CurValue: tytyy ETValue: tytyyui
Why are so many changes in focus?
As another way to determine the change in the text?