Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 25th, 2012  |  syntax: None  |  size: 0.54 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Opening an activity in Android without having to Reload it from scratch
  2. Intent intent = new Intent(this,SecondActivity.class);
  3.                 startActivityForResult(intent, RESULT_OK);
  4.        
  5. public void onActivityResult(int requestCode, int resultCode, Intent data) {
  6.     if (resultCode == RESULT_OK) {
  7.        // When you are back from second Activity you are land here ..
  8.        // do what ever you want to, without re Creating the this Activity
  9.     }
  10. }
  11.        
  12. Activity.this.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK));