Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. package com.example.karapuzik.p0261_intentfilter;
  2.  
  3. import android.support.v7.app.ActionBarActivity;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. import android.widget.Button;
  7. import android.content.Intent;
  8. import android.view.View.OnClickListener;
  9.  
  10.  
  11.  
  12. public class MyActivity extends ActionBarActivity implements OnClickListener {
  13.  
  14. @Override
  15. protected void onCreate(Bundle savedInstanceState) {
  16. super.onCreate(savedInstanceState);
  17. setContentView(R.layout.activity_my);
  18.  
  19. Button btnTime = (Button) findViewById(R.id.btnTime);
  20. Button btnDate = (Button) findViewById(R.id.btnDate);
  21.  
  22. btnTime.setOnClickListener(this);
  23. btnDate.setOnClickListener(this);
  24.  
  25.  
  26. }
  27.  
  28. @Override
  29. public void onClick(View v) {
  30. Intent intent;
  31.  
  32. switch (v.getId()) {
  33. case R.id.btnTime:
  34. intent = new Intent("com.example.karapuzik.p0261_intentfilter.action.showtime");
  35. startActivity(intent);
  36. break;
  37. case R.id.btnDate:
  38. intent = new Intent("com.example.karapuzik.p0261_intentfilter.action.showdate");
  39. startActivity(intent);
  40. break;
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement