Guest User

Untitled

a guest
May 25th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  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));
Advertisement
Add Comment
Please, Sign In to add comment