ghorardim

android call,msg,email

Oct 13th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. package com.example.hstu.callmsgemail;
  2.  
  3. import android.content.Intent;
  4. import android.net.Uri;
  5. import android.provider.Telephony;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.os.Bundle;
  8. import android.view.View;
  9. import android.widget.Button;
  10.  
  11. public class MainActivity extends AppCompatActivity {
  12.    
  13.     private Button email,msg,call;
  14.  
  15.     @Override
  16.     protected void onCreate(Bundle savedInstanceState) {
  17.         super.onCreate(savedInstanceState);
  18.         setContentView(R.layout.activity_main);
  19.  
  20.         email = (Button)findViewById(R.id.emailID);
  21.         msg = (Button)findViewById(R.id.msgID);
  22.         email = (Button)findViewById(R.id.callID);
  23.        
  24.         call.setOnClickListener(new View.OnClickListener() {
  25.             @Override
  26.             public void onClick(View view) {
  27.                 String phone = "01791810207";
  28.                 Intent intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel",phone,null));
  29.                 startActivities(intent);
  30.             }
  31.         });
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment