I have created an ExpandableListView with an EditText in a GroupView. Is there someone who knows how to save(maintain) the EditText values of the GroupView?.
It the same principle
//you need to allocate the data structure in size of the amount of items in your list
List<String> _retData = new ArrayList<String>(_data.size());
@Override public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
Holder h = null; //this will hold the edittext instances of eachItem in expand list
if(convertView==null)
{
convertView = LayoutInflater.from(_context).inflate(android.R.layout.simple_expandable_list_item_2,
parent, false);
h = new Holder();
h._editText = (EditText)convertView.findViewById(R.id.edit1);
convertView.setTag(h);
}
else
{
h = (Holder)convertView.getTag();
}
//saving the data when the user write something...
h._editText.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}
public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
_retData.get(groupPosition)._itemPlant = s.toString();
}
});
}
you can see in more details the post in my comment above
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.