I made expandablelistview with textView and switch in the child group. I want to use the status of switch(On or OFF) to control the device connected to the ESP8266 WiFi module. How can I store the switch data to use it somewhere else?
Adapter java file:
public class AdpMain extends BaseExpandableListAdapter {
private Context context;
private ArrayList<String> arrayGroup;
private HashMap<String, ArrayList<String>> arrayChild;
public AdpMain(Context context, ArrayList<String> arrayGroup, HashMap<String, ArrayList<String>> arrayChild)
{
super();
this.context = context;
this.arrayGroup = arrayGroup;
this.arrayChild = arrayChild;
}
...
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
{
String childName = arrayChild.get(arrayGroup.get(groupPosition)).get(childPosition);
View v = convertView;
if(v == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = (RelativeLayout)inflater.inflate(R.layout.activity_listview_child, null);
}
TextView textChild = (TextView)v.findViewById(R.id.textChild);
textChild.setText(childName);
return v;
}
}