android - Get sms address from intent data -


i need retrieve phone number different type of intents. cases intents as:

intent smsintent = new intent(android.content.intent.action_view); smsintent.settype("vnd.android-dir/mms-sms"); smsintent.putextra("address","phonenumber");          smsintent.putextra("sms_body","message"); startactivity(smsintent); 

or:

intent sms_intent = new intent(intent.action_sendto, uri.parse("smsto:xxxxxxxxxx");  sms_intent.putextra("sms_body", "this message!");  startactivity(sms_intent); 

when start new activity, bundle extras with:

bundle extras = getintent().getextras();     if (extras != null) {         //some code     } 

specifically, first case intent explicitly bind key "address" do:

extra_phonenumber = extras.getstring("address"); 

but i'm having trouble trying retrieve value after smsto: second intent case.

i tried iterate through bundle extras with:

for (string key : bundle.keyset()) { object value = bundle.get(key); log.d(tag, string.format("%s %s (%s)", key,       value.tostring(), value.getclass().getname())); 

}

but if extras empty give me npe.

i couldn't find because of lack of documentation google answer helpful! in advance.

i suggest check how 2nd case intent inside via debugger. there other fields extras information can stored. please check intent.getdata() or intent.getdatastring()


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -