Variable cannot be resolved
Posted
by Devel
on Stack Overflow
See other posts from Stack Overflow
or by Devel
Published on 2010-04-06T14:37:32Z
Indexed on
2010/04/06
14:43 UTC
Read the original article
Hit count: 469
Hi, I am trying to create an item list, diffrent for each i and j variable. My code is:
if (i == 0) {
if (j == 0) {
final CharSequence[] items = {"4:45", "5:00"}
} else if (j == 1) {
final CharSequence[] items = {"4:43", "4:58"}
} else if (j == 2) {
final CharSequence[] items = {"4:41", "4:56"}
} else {
final CharSequence[] items = {"4:38", "4:53"}
}
...
new AlertDialog.Builder(this)
.setTitle("Hours")
.setItems(items,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialoginterface, int i) {
// getStation(i);
}
})
.show();
}
I get an error in the line .setItems(items,
:
items cannot be resolved
I think that the compiler thinks that the CharSequence[] items
may not be initialised or something...
How can I make this programme run?
© Stack Overflow or respective owner