Posted By

variable3 on 04/27/11


Tagged

list browser button click message box a on contact lunch Dialer


Versions (?)

Android lunch Dialer, Message box, Browser, Contact List


 / Published in: Java
 

  1. Button bCall,bMsg,bContact,bURL;
  2. public void onCreate(Bundle savedInstanceState) {
  3. super.onCreate(savedInstanceState);
  4. setContentView(R.layout.main);
  5. bCall=(Button)findViewById(R.id.CALLButtonId);
  6. bMsg=(Button)findViewById(R.id.MessageButtonID);
  7. bContact=(Button)findViewById(R.id.ContactsButtonID);
  8. bURL=(Button)findViewById(R.id.URLButtonID);
  9. //To lunch DIALER
  10. bCall.setOnClickListener(new View.OnClickListener() {
  11. public void onClick(View arg0) {
  12. Intent intent = new intent(Intent.ACTION_DIAL,Uri.parse("tel:9800222333"));
  13. startActivity(intent);
  14.  
  15. }
  16. });
  17.  
  18. //To lunch MESSAGEBOX
  19. bMsg.setOnClickListener(new View.OnClickListener() {
  20. public void onClick(View arg0) {
  21.  
  22. Intent sendIntent = new Intent(Intent.ACTION_VIEW);
  23. sendIntent.setData(Uri.parse("scheme://data"));
  24. sendIntent.setType("vnd.android-dir/mms-sms");
  25. sendIntent.putExtra("sms_body", "Msg hiiii");
  26. sendIntent.putExtra("address", "99007777888");
  27. startActivity(sendIntent);
  28.  
  29.  
  30. }
  31. });
  32.  
  33. //To lunch CONTACTS LIST
  34. bContact.setOnClickListener(new View.OnClickListener() {
  35. public void onClick(View arg0) {
  36. Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);
  37. startActivity(contactPickerIntent);
  38.  
  39.  
  40. }
  41. });
  42.  
  43. //To lunch BROWSER
  44. bURL.setOnClickListener(new View.OnClickListener() {
  45. public void onClick(View arg0) {
  46. Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com"));
  47. startActivity(intent);
  48.  
  49. }
  50. });
  51. }

Report this snippet  

You need to login to post a comment.