July 16, 2017
Android phone call tutorial source code 2017
Android phone call simple example tutorial source code
Work with android code here is most recent code keep up to date with us no deprecation. Further if you found any deprecation in code snippets please comment us below. Android phone call activity java source code below. Video link https://www.youtube.com/watch?v=SdqEdyM8s7o Android voice recording source code. package attraction.blessme.begin; import android.net.Uri; import android.os.Bundle; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity { private EditText numberField; private Button buttonToCall; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); numberField = (EditText)findViewById(R.id.get_number); buttonToCall = (Button)findViewById(R.id.dial_to_call); buttonToCall.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { String phNumber = numberField.getText().toString(); Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("Dial:"+phNumber)); //You may get alert don't worry. startActivity(callIntent); } }); } }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:tools="http://schemas.android.com/tools" android:background="#ffde5c" tools:context=".MainActivity"> <Button android:id="@+id/dial_to_call" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Call To This Number" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="199dp" /> <EditText android:id="@+id/get_number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffcaaf" android:textAllCaps="true" android:inputType="phone" android:ems="10" android:layout_above="@+id/dial_to_call" android:layout_centerHorizontal="true" android:layout_marginBottom="62dp" /> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="attraction.blessme.begin"> <uses-permission android:name="android.permission.CALL_PHONE" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>