问题描述:

**

I made an expandable list. In which i have included the edittext

inside the child group. when i collapse the parent group the number

entered vanishes. how should i save the values entered inside the

child edittext views.?

**

@Override

public View getChildView(int groupPosition, final int childPosition,

boolean isLastChild, View convertView, ViewGroup parent) {

 final HashMap<String, String> childCol = getChild(groupPosition, childPosition);

if (convertView == null) {

LayoutInflater infalInflater = (LayoutInflater) this._context

.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

convertView = infalInflater.inflate(R.layout.list_item3, null);

}

TextView txtListChild = (TextView) convertView

.findViewById(R.id.lblListItem);

txtListChild.setText(childCol.get("name").toString());

EditText editetext = (EditText) convertView

.findViewById(R.id.lblListItemEditext);

editetext.setText(childCol.get("number").toString());

editetext.addTextChangedListener(new TextWatcher() {

@Override

public void onTextChanged(CharSequence s, int start,

int before, int count) {

//Toast.makeText(_context, "a", Toast.LENGTH_LONG).show();

}

@Override

public void beforeTextChanged(CharSequence s, int start,

int count, int after) {

//Toast.makeText(_context, "b", Toast.LENGTH_LONG).show();

// TODO Auto-generated method stub

}

@Override

public void afterTextChanged(Editable s) {

EditText tt=(EditText) s ;

Toast.makeText(_context,tt.getTag().toString(), Toast.LENGTH_SHORT).show();

});

return convertView;

}

相关阅读:
Top