Hi,

This was solved by calling another activity. It means UI displayed in
one activity and sms sending task achieved in another activity. I dont
know whether this is the way or not but it removed this error.

Sunil

On Dec 31 2008, 1:52 pm, javame_android <su...@saltriver.com> wrote:
> Hi,
>
> Did what you said but no success. Still the same problem GUI displayed
> properly but after entering number in the textbox and pressing the
> button it gives on ddms console as could not connect to client
> socket : connection refused.
>
> By the way I did what you said but I dont think for sending sms one
> has to write uses-permission for receiving sms.
> Anyways thanks.
>
> Is there anybody who has encountered same error and can help me out.
>
> Thanks & Regards
> Sunil
>
> On Dec 31, 12:54 pm, "Shazia Naz" <mhsha...@gmail.com> wrote:
>
> > 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 <su...@saltriver.com>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 android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to