Hi, Just add this in your Android Manifest.xml.
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission> HOPE IT WORKS. Regards, Shazia. On Wed, Dec 31, 2008 at 12:26 PM, javame_android <[email protected]>wrote: > > package com.android.hello; > > import android.app.Activity; > import android.os.Bundle; > import android.view.View; > import android.widget.Button; > import android.widget.EditText; > import android.telephony.gsm.SmsManager; > import android.text.Editable; > > public class HelloAndroid extends Activity > { > final String textMsg = "Hello, Message sent on Click"; > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > setContentView(R.layout.login); > final SmsManager smsManager = SmsManager.getDefault(); > Button button = (Button)findViewById(R.id.ok); > button.setOnClickListener(new Button.OnClickListener() > { > public void onClick(View arg0) > { > EditText editText = > (EditText)findViewById(R.id.entry); > Editable tPhone = editText.getText(); > String numToSendMsg = tPhone.toString(); > smsManager.sendTextMessage(numToSendMsg, null, > textMsg, null, null); > } > }); > } > } > > Above is the code that I am trying to run. Everything is working fine, > GUI is displayed properly. The problem only comes when I click on > button. I am very new to Android so not getting where I am getting > wrong. > > Thanks > Sunil > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

