tags:

views:

30

answers:

2

Friend's anybody provide some sample code to send SMS from android device.

Thanks in advance.

+4  A: 

Here you go.

CommonsWare
very well played
KevinDTimm
thanks for your answer
MGS
how can i check whether manually entere number is valid...if i suppose have to send sms to this number 11111111111,but nobody have this number at the time i need to display sending failed with toast message how can i check the number in universal phone directory for its availability.
MGS
@MGS: There is no "universal phone directory", AFAIK.
CommonsWare
+1  A: 
public void sendAText(String phonenumber){
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.putExtra("address", phonenumber);
    intent.setType("vnd.android-dir/mms-sms");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}
atraudes
+1 thanks for your response.
MGS
how can i check whether manually entere number is valid...if i suppose have to send sms to this number 11111111111,but nobody have this number at the time i need to display sending failed with toast message how can i check the number in universal phone directory for its availability.
MGS
That's a very complicated answer :-P Start by taking a look here:
atraudes
http://developer.android.com/resources/articles/contacts.html I imagine you'll have to parse through the contacts
atraudes