Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. package com.example.states;
  2.  
  3. import android.app.Activity;
  4. import android.app.ProgressDialog;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Toast;
  8.  
  9. public class MainActivity extends Activity {
  10.  
  11. @Override
  12. protected void onCreate(Bundle savedInstanceState) {
  13. super.onCreate(savedInstanceState);
  14. setContentView(R.layout.activity_main);
  15. Toast.makeText(getApplicationContext(), "Activity created", Toast.LENGTH_LONG).show();
  16. }
  17.  
  18. public void click(View v) {
  19. ProgressDialog pd = new ProgressDialog(this);
  20. pd.setTitle("Hi, bro");
  21. pd.show();
  22. }
  23.  
  24. @Override
  25. protected void onDestroy() {
  26. Toast.makeText(getApplicationContext(), "Activity destroyed", Toast.LENGTH_LONG).show();
  27. super.onDestroy();
  28. }
  29. @Override
  30. protected void onStart() {
  31. Toast.makeText(getApplicationContext(), "Activity started", Toast.LENGTH_LONG).show();
  32. super.onStart();
  33. }
  34.  
  35. @Override
  36. protected void onStop() {
  37. Toast.makeText(getApplicationContext(), "Activity stopped", Toast.LENGTH_LONG).show();
  38. super.onStop();
  39. }
  40. @Override
  41. protected void onPause() {
  42. Toast.makeText(getApplicationContext(), "Activity paused", Toast.LENGTH_LONG).show();
  43. super.onPause();
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement