Showing posts with label Phone Dialer In Android. Show all posts
Showing posts with label Phone Dialer In Android. Show all posts

Monday, June 17, 2013

Phone Dialer In Android

Hi Guys!
Today i am going to share the code of Action dial in android.
Phone dialer is an activity available with Android operating system to call a number. In this article, we will create an application which invokes the dialer on a button click.  Android system provides a standard action name called �ACTION_DIAL� to invoke the dialer. We will make use this action to invoke the the dialer from our application.

Main.xml




MainActivity.java

package com.sunil.dial;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button btn = (Button) findViewById(R.id.btn);

OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent("android.intent.action.DIAL");
startActivity(intent);
}
};

btn.setOnClickListener(listener);
}
}


Cheers Guys!

 

Copyright @ 2013 Android Developers Tipss.