Wednesday, December 1, 2010

Dial Activity Using Intent






 Button btPhone = (Button)v.findViewById(R.id.dialButton);

btPhone.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            dialPhone();
                        }
                                         });
                  



then


private void dialPhone() {
        Intent dialIntent = new Intent(Intent.ACTION_DIAL, Uri
                .parse("tel:9751076707"));
        Activity parentAct = (Activity)this.getContext();
        parentAct.startActivity(dialIntent);
    }

3 comments:

  1. hi,
    i had a doubt, why should we use this line. what is the purpose?
    Activity parentAct = (Activity)this.getContext();

    i think directly use startActivity(dialIntent), it works!

    could u pls explain me?

    ReplyDelete
  2. dude!! i need a source code!! plz

    ReplyDelete
  3. i need source code of application buddy.............!!!do reply>>>>

    ReplyDelete

Check out this may be help you

Related Posts Plugin for WordPress, Blogger...