Ok, I'm going to try to explain this one as easy as possible! I'm sure I'm overlooking something simple - but have been staring at the screen too long to identify. As always, thanks for helping!
In my Main activity I have:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'handles the back key and the menu key
If KeyCode = KeyCodes.KEYCODE_BACK Then 'back keySub Activity_KeyPress (KeyCode As Int) As Boolean
Quitandsave
End If
Return True
End Sub
The Sub - Quitandsave adds a panel view to the current activity (in Main) - on the panel are two buttons - yes to quit and no (change their mind and return to the application).
What I'm finding is that when the back key is pressed - the panel is displayed properly, and the yes/no buttons work fine.
However, if while the panel is visible from the initial back key press, and then the back key is pressed once again (on purpose or accident) - the yes button still works (panel removes, files saves, app quits), but the no button doesn't - like it is frozen - and the panel won't remove. Is it because of initialize? ... or something else?
Here is my yes/no button code:
Sub quitsavebtn1_Click ' yes - quit and save
WriteMapSavePage 'calls a sub that writes map to int or external space
Activity.Finish ' exit the application
End Sub
Sub quitsavebtn2_Click 'no - don't quit and save
quitsavepnl.RemoveView 'remove the panel to continue using app
End Sub
In my Quitandsave Sub:
Sub Quitandsave
quitsavepnl.Initialize("quitsavepnl")
.... code here to set colors,font etc.
Activity.AddView(quitsavepnl,15dip,15dip, 50%x, 50%y)
.... code here to add buttons to panel etc.
quitsavepnl.Visible = True
End Sub