ACTION_DIAL works fine and without any changes to the permissions.

thanks a lot

--aj



On Dec 15, 6:40 am, Sean Hodges <seanhodge...@googlemail.com> wrote:
> Nithin is right, you need to add the following permission to your
> AndroidManifest.xml, if it's not there already:
>
> <uses-permission id="android.permission.CALL_PHONE"/>
>
> You'll find that the KEYCODE_CALL button is being ignored, because by
> default special buttons like the back/call/home ones are handled
> internally. You need to override this behaviour by adding the
> following line into the onCreate() of your activity:
>
> setDefaultKeyMode(Activity.DEFAULT_KEYS_DIALER);
>
> The rest looks OK to me. If you still have problems, try stepping
> through the code in the debugger to determine which line is not
> executing correctly...
>
>
>
> On Tue, Dec 15, 2009 at 11:18 AM, Nithin <nithin.war...@gmail.com> wrote:
>
> > just hard the number in startActivity() and try..
> > Then you are giving permission in Manifest, right ..
>
> > On Dec 15, 10:26 am, AJ <amanjsi...@gmail.com> wrote:
> >> Thanks... but taht does not help either. It launches but the call
> >> button does not work:
>
> >> [2009-12-15 00:21:13 - HelloAndroid]Waiting for HOME
> >> ('android.process.acore') to be launched...
>
> >> [2009-12-15 00:21:14 - Emulator]2009-12-15 00:21:14.866 emulator
> >> [656:903] Warning once: This application, or a library it uses, is
> >> using NSQuickDrawView, which has been deprecated. Apps should cease
> >> use of QuickDraw and move to Quartz.
>
> >> [2009-12-15 00:22:58 - HelloAndroid]HOME is up on device
> >> 'emulator-5554'
> >> [2009-12-15 00:22:58 - HelloAndroid]Uploading HelloAndroid.apk onto
> >> device 'emulator-5554'
> >> [2009-12-15 00:22:59 - HelloAndroid]Installing HelloAndroid.apk...
> >> [2009-12-15 00:23:17 - HelloAndroid]Success!
> >> [2009-12-15 00:23:17 - HelloAndroid]Starting activity
> >> com.tests.helloandroid.HelloAndroid on device
> >> [2009-12-15 00:23:27 - HelloAndroid]ActivityManager: Starting: Intent
> >> { cmp=com.tests.helloandroid/.HelloAndroid }
>
> >> There was a warning though. Not sure why doesn't this code work.
>
> >> --aj
>
> >> On Dec 14, 11:56 pm, Nithin <nithin.war...@gmail.com> wrote:
>
> >> > hi,
>
> >> > try mEditText_number.getText().toString();
>
> >> > Thanks
>
> >> > On Dec 15, 9:41 am, AJ <amanjsi...@gmail.com> wrote:
>
> >> > > I am trying to make a very very simple app as a beginner but it does
> >> > > not work. The app just has a text bar and a button. Somehow, the call
> >> > > button does not start  a call.
>
> >> > > Help please. Here is the code:
>
> >> > > package com.tests.helloandroid;
>
> >> > > import android.app.Activity;
> >> > > import android.content.Intent;
> >> > > import android.net.Uri;
> >> > > import android.os.Bundle;
> >> > > import android.view.KeyEvent;
> >> > > import android.view.View;
> >> > > import android.widget.Button;
> >> > > import android.widget.EditText;
> >> > > import android.widget.LinearLayout;
>
> >> > > public class HelloAndroid extends Activity {
> >> > >   EditText mEditText_number = null;
> >> > >   LinearLayout mLinearLayout_no_button = null;
> >> > >   Button mButton_dial = null;
>
> >> > >   /** Called when the activity is first created. */
> >> > >   @Override
> >> > >   public void onCreate(Bundle savedInstanceState) {
> >> > >     super.onCreate(savedInstanceState);
>
> >> > >     mLinearLayout_no_button = new LinearLayout(this);
>
> >> > >     mEditText_number = new EditText(this);
> >> > >     mEditText_number.setText("5551222");
> >> > >     mLinearLayout_no_button.addView(mEditText_number);
>
> >> > >     mButton_dial = new Button(this);
> >> > >     mButton_dial.setText("Dial!");
> >> > >     mLinearLayout_no_button.addView(mButton_dial);
> >> > >     mButton_dial.setOnClickListener(new View.OnClickListener() {
> >> > >       public void onClick(View v) {
> >> > >         performDial();
> >> > >       }
> >> > >     });
>
> >> > >     setContentView(mLinearLayout_no_button);
> >> > >   }
>
> >> > >   public boolean onKeyDown(int keyCode, KeyEvent event) {
> >> > >     if (keyCode == KeyEvent.KEYCODE_CALL) {
> >> > >       performDial();
> >> > >       return true;
> >> > >     }
> >> > >     return false;
> >> > >   }
>
> >> > >   public void performDial(){
> >> > >     if(mEditText_number!=null){
> >> > >       try {
> >> > >         startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:"
> >> > > + mEditText_number.getText())));
> >> > >       } catch (Exception e) {
> >> > >         e.printStackTrace();
> >> > >       }
> >> > >     }//if
> >> > >   }
>
> >> > > }
>
> > --
> > 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

-- 
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