Guest User

Untitled

a guest
Aug 14th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. Android get previous activity
  2. Intent intent = new Intent(this, next.class);
  3. intent.putExtra("activity","first");
  4. startActivity(intent);
  5.  
  6. Intent intent = getIntent();
  7. String activity = intent.getStringExtra("activity");
  8.  
  9. Intent i = new Intent(this, deliveries.class);
  10. i.putExtra("ActivityName", "ActivityOne");
  11. startActivity(i);
  12.  
  13. Bundle extra = getIntent().getExtras();
  14. String activityName= Long.parseLong(extra.getSerializable("ActivityName")
  15. toString());
  16.  
  17. public ComponentName getCallingActivity()
  18.  
  19. Intent i = new Intent(Activity1.this, MainActivity.class).putExtra("from", "activity1");
  20. startActivity(i);
  21.  
  22. if(getIntent().getStringExtra("from").equals("activity1")){
  23. //From Activity 1
  24. }else {
  25. // Activity 2
  26. }
  27.  
  28. startChildActivity("first", new Intent(this, First.class));
  29.  
  30. getParent()
Add Comment
Please, Sign In to add comment