Search code examples
androidsmsphone-call

Best way to make call number or send a menssage


what i want is onclick in name = textview it pop up a window with 2 buttons 1 button for phone call and other button for sms.


Solution

  • first google about it. What is alertdialog box then by using on button click make a call by using

    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phone1.getText().toString()));
    

    where phone1 is a EditText and send SMS like

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:" + phoneNumber));     
    intent.putExtra("sms_body", message); 
    startActivity(intent);
    

    hope you got want you want