Guest User

Untitled

a guest
Jul 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. package mah.mosa.skola;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.view.View.OnClickListener;
  8. import android.widget.Button;
  9.  
  10. public class IndividiuellUppgiftActivity extends Activity implements
  11. OnClickListener {
  12. /** Called when the activity is first created. */
  13. @Override
  14. public void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.main);
  17.  
  18. Button btn;
  19. Button btn2;
  20.  
  21. btn2 = (Button) findViewById(R.id.button2);
  22. btn = (Button) findViewById(R.id.button1);
  23.  
  24. btn.setOnClickListener(this);
  25. btn2.setOnClickListener(this);
  26. }
  27.  
  28. @Override
  29. public void onClick(View v) {
  30. Intent changeActivity;
  31. Intent changeActivity2;
  32.  
  33. if (v == btn1) {
  34.  
  35. changeActivity = new Intent(IndividiuellUppgiftActivity.this,
  36. Search.class);
  37. changeActivity.putExtra("search", true);
  38. startActivity(changeActivity);
  39. }
  40. else if (v == btn2) {
  41. changeActivity = new Intent(IndividiuellUppgiftActivity.this,
  42. Search.class);
  43. startActivity(changeActivity);
  44. }
  45.  
  46. }
  47.  
  48.  
  49. }
Add Comment
Please, Sign In to add comment