• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Problem creating new screen

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();
}
});
 
There's many ways I've tried this. Each one gives me:

IllegalStateException: Could not find a method nextScreen(View) in the activity

I even started dropping nextScreen() functions in activities just for the hell of it. Nothing. I think it has something to do with trying to create a View from within an innerclass (but, if I really knew what I was doing wrong, I wouldn't be here, would I?)
 
Back
Top Bottom