The below code is enough to make a call from the application,
Java
Intent sIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:919894643826"));
startActivity(sIntent);
We can put this code in a click event, so that on clicking a button or textview the call be done.
Likewise we need to add this line inside the Manifest.xml file
XML
<uses-permission android:name="android.permission.CALL_PHONE"></uses>
The java code will be like this
Caller.java
package com.phone.calller;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Callers extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button Phone = (Button) findViewById(R.id.call);
Phone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent sIntent = new Intent(Intent.ACTION_CALL, Uri
.parse("tel:919894643826"));
startActivity(sIntent);
}
});
}
}
and the manifest.xml file will be like this
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phone.calller"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Callers"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.CALL_PHONE" />
</manifest>
Have a good day.
The full source code
Pretty nice code! Thanks a lot!
ReplyDelete___
Cheap international calls
wow thank U
ReplyDeleteGoogle is one of the popular search Engine.Google is playing an Important role In internet marketing field.
ReplyDeleteAndroid app developers
You are perfect :)
ReplyDeleteThe telephone is the best medium if you want to communicate with other people but it could also be used to harass other people. Dealing with free business calls harassment could be really scary and annoying. You should know what to do to put a stop to harassing phone calls and secure your privacy.
ReplyDeleteThis is really nice post works well and easy to configure...thanks for all info.
ReplyDeleteFree Source Code
Free Source code For Academic
Academic Project Download
Academic Project Free Download
Freelancer In India
I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
ReplyDeletePhp projects with source code
Online examination system in php
Student management system in php
Php projects for students
Free source code for academic
Academic projects provider in nashik
Academic project free download