Advertisement
Guest User

Main Intent

a guest
Nov 21st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. import org.apache.http.protocol.HTTP;
  2.  
  3. import android.content.Intent;
  4. import android.net.Uri;
  5. import android.os.Bundle;
  6. import android.support.v7.app.ActionBarActivity;
  7. import android.view.Menu;
  8. import android.view.MenuItem;
  9. import android.view.View;
  10.  
  11.  
  12. public class MainActivity extends ActionBarActivity {
  13.  
  14. @Override
  15. protected void onCreate(Bundle savedInstanceState) {
  16. super.onCreate(savedInstanceState);
  17. setContentView(R.layout.activity_main);
  18.  
  19. }
  20.  
  21. public void Bnt_ActionView (View view) {
  22. // Intent intent = new Intent(this, LinearLayoutActivity.class);
  23. // startActivity(intent);
  24. Intent intent = new Intent(Intent.ACTION_VIEW);
  25. intent.setData(Uri.parse("http://www.google.com"));
  26. startActivity(intent);
  27. }
  28.  
  29. public void Bnt_ActionDial (View view) {
  30. Intent intent = new Intent(Intent.ACTION_DIAL);
  31. startActivity(intent);
  32. }
  33.  
  34. public void Bnt_ActionDialCall (View view) {
  35. Intent intent = new Intent(Intent.ACTION_CALL);
  36. intent.setData(Uri.parse("tel:5524741704"));
  37. startActivity(intent);
  38. }
  39.  
  40. public void Bnt_GoogleMaps(View view) {
  41. Intent intent = new Intent(Intent.ACTION_VIEW,
  42. Uri.parse("geo:41.656313,-0.877351"));
  43. startActivity(intent);
  44. }
  45.  
  46. public void Bnt_TakePicture(View view) {
  47. Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
  48. startActivity(intent);
  49. }
  50.  
  51. public void Bnt_Email(View view) {
  52. Intent intent = new Intent(Intent.ACTION_SEND);
  53. intent.setType("text/plain");
  54. intent.putExtra(Intent.EXTRA_SUBJECT, "asunto");
  55. intent.putExtra(Intent.EXTRA_TEXT, "texto del correo");
  56. intent.putExtra(Intent.EXTRA_EMAIL,
  57. new String[] {"omendoza@arcelia.net" });
  58. startActivity(intent);
  59. }
  60.  
  61. public void Bnt_MmsMessage(View view) {
  62. Intent intent = new Intent(Intent.ACTION_SEND);
  63. intent.setType(HTTP.PLAIN_TEXT_TYPE);
  64. intent.putExtra("sms_body", "Mensaje de Prueba");
  65. startActivity(intent);
  66. }
  67.  
  68.  
  69. @Override
  70. public boolean onCreateOptionsMenu(Menu menu) {
  71. // Inflate the menu; this adds items to the action bar if it is present.
  72. getMenuInflater().inflate(R.menu.main, menu);
  73. return true;
  74. }
  75.  
  76. @Override
  77. public boolean onOptionsItemSelected(MenuItem item) {
  78. // Handle action bar item clicks here. The action bar will
  79. // automatically handle clicks on the Home/Up button, so long
  80. // as you specify a parent activity in AndroidManifest.xml.
  81. int id = item.getItemId();
  82. if (id == R.id.action_settings) {
  83. return true;
  84. }
  85. return super.onOptionsItemSelected(item);
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement