dimanche 1 mars 2015

I can't create second ListItem


Vote count:

0




I have a list and an list item with subitem. But I need second listitem and second listitem's subitems. So how can I add second, third... items and subitems to my project? *Sorry for my poor english.



package com.deneeme.deneme;

import java.util.ArrayList;

import com.deneeme.deneme.R;

import android.app.Activity;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.Menu;
import android.widget.ExpandableListView;
import android.widget.TextView;

public class MainActivity extends Activity {
// more efficient than HashMap for mapping integers to objects
SparseArray<Group> groups = new SparseArray<Group>();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
createData();
ExpandableListView listView = (ExpandableListView) findViewById(R.id.listView);
MyExpandableListAdapter adapter = new MyExpandableListAdapter(this,
groups);
listView.setAdapter(adapter);
}

public void createData() {
for (int a = 0; a < 1; a++) {
Group group = new Group("Elma");
for (int b = 0; b < 1; b++) {
group.children.add("E1");
group.children.add("E2");
group.children.add("E3");
}
groups.append(a, group);
}
}
}


asked 40 secs ago







I can't create second ListItem

Aucun commentaire:

Enregistrer un commentaire