Я сделал расширение с помощью textView и переключился в дочернюю группу. Я хочу использовать статус переключателя (Вкл. Или Выкл.) Для управления устройством, подключенным к модулю WiFi ESP8266. Как сохранить данные коммутатора, чтобы использовать его где-то еще?Android Studio добавляет «Switch» в дочернюю группу ExpandableListView
адаптер Java файл:
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;
}
}
пожалуйста, посмотрите на это руководство .. http://developer.android.com/guide/topics/data /data-storage.html –