Hi Guys!
Today I am sharing the code for dial a number to call any guys from android device.
In this article we will create an application which can call a telephone number directly from the application. In order to call a number we will make use the standard action called ACTION_CALL. An application can call a number directly if and only if the necessary permission is explicitly granted. For this we need to provide CALL_PHONE permission to the application.
Cheers Guys!
Today I am sharing the code for dial a number to call any guys from android device.
In this article we will create an application which can call a telephone number directly from the application. In order to call a number we will make use the standard action called ACTION_CALL. An application can call a number directly if and only if the necessary permission is explicitly granted. For this we need to provide CALL_PHONE permission to the application.
Main.xml
MainActivity.java
package com.sunil.call;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity implements OnClickListener{
/** 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.btnCall);
btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
EditText telNo = (EditText) findViewById(R.id.telNo);
String strTelNo = telNo.getText().toString();
Intent intent = new Intent("android.intent.action.CALL");
Uri data = Uri.parse("tel:"+ strTelNo );
intent.setData(data);
startActivity(intent);
}
}
Menifest.xml
Cheers Guys!
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :