Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. package blogging.pivincii.activitylifecycle;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.util.Log;
  7. import android.view.View;
  8.  
  9. public class MainActivity extends Activity {
  10. private static String TAG = "LifeCycle " + MainActivity.class.getSimpleName();
  11.  
  12. @Override
  13. protected void onCreate(Bundle savedInstanceState) {
  14. super.onCreate(savedInstanceState);
  15. setContentView(R.layout.activity_main);
  16. Log.i(TAG, "onCreate");
  17. }
  18.  
  19. @Override
  20. protected void onStart() {
  21. super.onStart();
  22. Log.i(TAG, "onStart");
  23. }
  24.  
  25. @Override
  26. protected void onRestart() {
  27. super.onRestart();
  28. Log.i(TAG, "onRestart");
  29. }
  30.  
  31. @Override
  32. protected void onResume() {
  33. super.onResume();
  34. Log.i(TAG, "onResume");
  35. }
  36.  
  37. @Override
  38. protected void onPause() {
  39. super.onPause();
  40. Log.i(TAG, "onPause");
  41. }
  42.  
  43. @Override
  44. protected void onStop() {
  45. super.onStop();
  46. Log.i(TAG, "onStop");
  47. }
  48.  
  49. @Override
  50. protected void onDestroy() {
  51. super.onDestroy();
  52. Log.i(TAG, "onDestroy");
  53. }
  54.  
  55. public void onClick(View view) {
  56. switch (view.getId()) {
  57. case R.id.next_activity_button:
  58. Intent intent = new Intent(MainActivity.this, SecondActivity.class);
  59. startActivity(intent);
  60. break;
  61. default:
  62. break;
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement