Skip to content

Instantly share code, notes, and snippets.

@justintoth
Created April 19, 2012 19:41
Show Gist options
  • Save justintoth/2423624 to your computer and use it in GitHub Desktop.
Save justintoth/2423624 to your computer and use it in GitHub Desktop.
NavigationActivity Exit
final ApplicationHandler msgHandler = new ApplicationHandler() {
@Override
public void onApplicationEvent(int nEvent, String strData) {
Log("Event No. " + Integer.toString(nEvent) + " detected."); // event handling
switch (nEvent) {
case ApplicationEvents.EVENT_APP_EXIT:
Log("In EVENT_APP_EXIT event");
Finish(SygicModule.EXIT_NORMAL, true);
break;
}
}
};
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Finish(SygicModule.EXIT_NORMAL, true);
return true;
}
return super.onKeyDown(keyCode, event);
}
private void Finish(int result, boolean destroy)
{
Log("In Finish");
//close api.
ApplicationAPI.CloseApi();
//finish activity.
setResult(result);
if(lock != null)
lock.release();
finish();
if(destroy)
onDestroy();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment