if else メソッドを使用して String 配列を初期化しようとしていますが、機能していません。どうやってするの ?
if(itemno==2){
String[] values = new String[] { "Category31",
"Category32",
"Category33",
"Category34",
"Category35",
"Category36",
"Category37",
"Android Example List View" ,
"daniel",
"dude",
"hello",
"super,","dukker"
};}
else if(itemno==3){
String[] values = new String[] { "Category31",
"Category32",
"Category33",
"Category34",
"Category35",
"Category36",
"Category37",
"Android Example List View" ,
"daniel",
"dude",
"hello",
"super,","dukker"
};}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
l.setAdapter(adapter);
しかし、アダプターでは、変数が受け入れられないというエラーが表示されています..助けてください