Advertisement
Guest User

Untitled

a guest
May 1st, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public class MainActivity extends AppCompatActivity
  2. {
  3. private static boolean callMethod=true;
  4. @Override
  5. protected void onResume() {
  6. super.onResume();
  7. if(callMethod)
  8. doSomething();
  9. }
  10. @Override
  11. protected void onPause() {
  12. super.onPause();
  13. callMethod=true;
  14. }
  15.  
  16. private void doSomething()
  17. {
  18. Log.i(“doSomething()”,”Did something.”);
  19. }
  20. @Override
  21. protected void onCreate(Bundle savedInstanceState) {
  22. super.onCreate(savedInstanceState);
  23. setContentView(R.layout.activity_main);
  24. if(callMethod)
  25. doSomething();
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement