Detect a number phone in the email body and call it

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

IT WOOOOOOOOOOOOOOOOOOORK :)

Postby aminaz » Sat Jan 16, 2010 3:05 pm

case CONTEXTMENU_CALL:
URLSpan[] numbers =txtbody.getUrls();
for(URLSpan number : numbers) {
Intent intent1 = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + number.getURL()));
startActivity(intent1);
}

break;

case CONTEXTMENU_INSEERTPHONE:
URLSpan[] numbers2 =txtbody.getUrls();
for(URLSpan number2 : numbers2) {
Intent intent2 = new Intent(Intent.ACTION_INSERT_OR_EDIT);
intent2.setType(Contacts.People.CONTENT_ITEM_TYPE);
String num= number2.getURL().toString();
String num1=num.replace("tel:","");
intent2.putExtra(Insert.PHONE, Uri.decode(num1));
startActivity(intent2);
}
break;
case CONTEXTMENU_INSEERTMYAPPLICATION:
URLSpan[] numbers3 =txtbody.getUrls();
for(URLSpan number3 : numbers3) {
Intent intent3 = new Intent(view_mail1.this, new_contact1.class);
String num= number3.getURL();
intent3.putExtra(Insert.PHONE,Uri.parse("tel:" +num));
startActivity(intent3);
}
break;

case CONTEXTMENU_SENDSMS:

URLSpan[] numbers4 =txtbody.getUrls();
for(URLSpan number4 : numbers4) {
Intent intent4 = new Intent(Intent.ACTION_VIEW,Uri.parse("address:"+number4.getURL()));
String num= number4.getURL().toString();
String num1=num.replace("tel:","");
intent4.setType("vnd.android-dir/mms-sms");
intent4.putExtra("address", num1);
startActivity(intent4);
}
break;
}


THNKS for the help :)
aminaz
Junior Developer
Junior Developer
 
Posts: 19
Joined: Thu Jan 07, 2010 5:07 pm

Top
Previous

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 7 guests