TheChosenOne
Lurker
What I'm trying to do: I have a dynamically generated list. I want to be able to click on an item, have an alert box come up asking me if I'd like to continue using the selection I made or if I'd like to make a new selection. If I choose make new selection, I have no problems. However, when I try to create a new screen, it puts up the new screen and crashes when I do anything in that screen. I know its not the screen, because I tested it with different screens that I know work. I included the code I think would be relevant below. If I try to pass itemClicked to newScreen, it tells me it needs to be a final... which wouldn't work because it will need to be changed. I'm sure there's a simple solution... I'm just too new to Android development to figure it out.
someList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View itemClicked, int position, long id) {
Global.setSomething(Something.blah.get(Global.getBlah()).getBlahByPos(position));
alertbox.setMessage(Something.blah.get(Global.getBlah()).getDescription());
alertbox.setNegativeButton("Select a different blah", null);
alertbox.setPositiveButton("Continue using " + Global.getBlah().toString(), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
newScreen();
}
});
alertbox.show();
}
});
someList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View itemClicked, int position, long id) {
Global.setSomething(Something.blah.get(Global.getBlah()).getBlahByPos(position));
alertbox.setMessage(Something.blah.get(Global.getBlah()).getDescription());
alertbox.setNegativeButton("Select a different blah", null);
alertbox.setPositiveButton("Continue using " + Global.getBlah().toString(), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
newScreen();
}
});
alertbox.show();
}
});