Expandableリストビューの子項目として、XMLレイアウト(フォーム送信用)を追加したい。arraylist を使用して追加できません。私を助けてください。前もって感謝します..これは私の主な活動です
public class MainActivity extends ExpandableListActivity implement OnChildClickListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ExpandableListView expandbleLis = getExpandableListView();
expandbleLis.setDividerHeight(2);
expandbleLis.setGroupIndicator(null);
expandbleLis.setClickable(true);
setGroupData();
setChildGroupData();
NewAdapter mNewAdapter = new NewAdapter(groupItem, childItem);
mNewAdapter
.setInflater(
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE),
this);
getExpandableListView().setAdapter(mNewAdapter);
expandbleLis.setOnChildClickListener(this);
}
public void setGroupData() {
groupItem.add("abcd");
groupItem.add("efgh");
}
ArrayList<String> groupItem = new ArrayList<String>();
ArrayList<Object> childItem = new ArrayList<Object>();
public void setChildGroupData() {
/**
* Add first child items
*/
ArrayList<String> child = new ArrayList<String>();
child.add("Java");
child.add("Drupal");
childItem.add(child);
/**
* Add second child items (here I want to add a xml Layout as a child item for form submission purpose)
*/
child = new ArrayList<String>();
child.add("Android");
child.add("Blackberry");
childItem.add(child);
}
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Toast.makeText(MainActivity.this, "Clicked On Child",
Toast.LENGTH_SHORT).show();
return true;
}
}