Button Press = Send SMS

Quickly share your Android Code Snippets here...

Button Press = Send SMS

Postby Dheano » Fri Jul 30, 2010 6:14 pm

Hi there, AndDev.org.

I normally read, not post. But on my current application idea, I am stuck at one point.

I have a button and I want to be able to send an SMS message on that click (to an already-set number with pre-set text).

Basically, I need to press the button to send a text to '20202' and the text inside the message says 'Balance'.

I can't work it out though!

Any help is appreciated.

~ Dheano
Dheano
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jul 27, 2010 3:39 am

Top

Re: Button Press = Send SMS

Postby r00t316 » Sun Aug 01, 2010 10:09 pm

SmsManager is what you will need and probably a permission in the manifest.xml

set in your layout xml for the button an android:OnClick="myClickHandler"
then in the activity

public void myClickHandler() {
... send text using SMSManger
}
r00t316
Developer
Developer
 
Posts: 29
Joined: Tue Jul 27, 2010 12:35 pm
Location: Florida

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 3 guests