I’m new to android development… I want to pass data to 2 ListViews through an ARRAY . Should I use a 2D array.? Then how?
What I want to do is;
Eg:In ListView1 there are
Fruits
Vegetables
Meat
When you click on Fruits in listviv1 the results(Mango, Banana, Apple, PineApple) should be disply in ListView2. I know that I can use extendable ListViews but I don’t want to do in that way. I need to use 2 ListViews. So far i did;
String items[] = { "Fruits", "Vegetables", "Jooses", "Meat", "Toys",
"Cookeys" };
String[][] groups = { { "Mango", "Banana", "Apple", "grapes", "paln" },
{ "Banana", "Apple", "grapes", "paln", "Green" },
{ "Red", "Green" }, { "Carrot" }
listviv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
switch (arg2) {
case 0:
Listviv.setAdapter(adapter2);
break;
case 1:
break;
default:
break;
}
}