Friday, April 13, 2012

How to make a phone call in a Android application

This may a looks like a simple task. Actually it is a simple task. You can do it using few lines of code. But there are only few places which shows how to do it. So I decided to mention it here.


public void onCallButtonClicked(View view) {
String url = "tel:" + tpNo;
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));
intent.setData(Uri.parse(url));
startActivity(intent);
}