0
我是新來的android開發...我想通過數組傳遞數據到2個ListViews。我應該使用2D陣列嗎?那怎麼樣?Array for 2 listviews in 1 Android Activity
我想要做的是;
例如:在ListView1的有
水果
蔬菜
肉類
當你點擊listviv1結果(芒果,香蕉,蘋果,菠蘿)瓜果要DISPLY在ListView2中。我知道我可以使用可擴展的ListView,但我不想這樣做。我需要使用2個ListViews。 到目前爲止,我做到了;
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;
}
}
謝謝,但我需要有2個listviews。我知道我可以使用extandable listviv,但在我的情況下,我需要有2個listviews。這是我想要做的事情。但我的應用程序有2個列表視圖 – Shazz