Call intent to make a call with put extra to select a phone number in Android? -


i trying create way user can contact friend via sms, email , phone call. have completed email , sms part. have figured out how use createchooser select how message sent using either email or text message, achieved clicking on button, following code how this:

intent = new intent(intent.action_send);                  i.settype("text/plain");                  i.putextra(intent.extra_email  , new string[]{""});                  i.putextra(intent.extra_subject, "check out awesome score!");                 i.putextra(intent.extra_text   , "i playing awesome game called tap button, , scored incredible highscore of " +s+ " taps!!\n\ncan beat it!?");                 try {                     startactivity(intent.createchooser(i, "send mail..."));                 } catch (android.content.activitynotfoundexception ex) {                     toast.maketext(fail.this, "there no email clients installed.", toast.length_short).show();                 } 

my aim have button opens form user can select phone number phones phone book.

the above email , text code allows me choose way send message available ways on phone, if select email creates form using putextra. want 1 put extras click on , select phone number phones address book. here latest attempt @ this:

   intent callintent = new intent(intent.action_call);                      callintent.settype("text/plain");                     callintent.putextra(intent.extra_phone_number, new string[]{""});                      try {                     startactivity(intent.createchooser(callintent, "calling..."));                 } catch (android.content.activitynotfoundexception ex) {                     toast.maketext(fail.this, "there no call clients installed.", toast.length_short).show();                 } 

when run code catches exception, saying there no call client. have permission in android manifest:

uses-permission android:name="android.permission.call_phone" 

i appreciate advice on this, thanks.

calling acheived using tel: scheme, not using extra:

intent callintent = new intent(intent.action_call); callintent.setdata(uri.parse("tel:" + number)); 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -