例如假设Foodmenu是该汉堡中的父项,piza是列表子菜单,另一个父项目商店菜单在该蔬菜店,非蔬菜店是列表submneu.Now当我点击Foodmenu它显示正确的数据。下一个我点击Shopmenu它显示商店菜单数据,但在Foodmenu daata更改它显示商店菜单数据我该如何解决?
private Context context;
private ArrayList<String> Mainmenu;
private ArrayList child;
private ArrayList<Object> Submenu;
String[] sub;
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
View view = convertView;
if(view == null){
LayoutInflater inflater = (LayoutInflater)this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.child_layout, parent, false);
}
TextView childItem = (TextView)view.findViewById(R.id.child_layout);
String item=Submenu.get(groupPosition).toString().replace("[","").replace("]","").replace("\"", "");
Log.e("Submenu",""+Submenu.get(0).toString());
sub=item.split(",");
Log.e("sub",""+sub);
for (int k = 0; k < sub.length; k++) {
child.add(sub[k]);
childItem.setText(child.get(childPosition).toString());
}
return view;
}