ad728

Sunday, June 10, 2018

AIDE Tutorial - 58 Call Action Button

AIDE Tutorial - 58 Call Action Button

Watch the video below
Main xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">
    <Button
android:onClick="call"
        android:text="Call"        android:layout_width="wrap_content"        android:layout_height="wrap_content" />
</LinearLayout>
MainActivity.java
package com.kcgroup.callaction;
import android.app.*;
import android.os.*;
import android.view.*;
import android.content.*;
import android.net.*;
public class MainActivity extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
public void call(View v){
Intent in=new Intent(Intent.ACTION_CALL,Uri.parse("tel:0123456789"));
startActivity(in);
}
}
Manifest.xml
<uses-permission android:name="android.permission.CALL_PHONE"/>
  
Share:

0 comments:

Post a Comment

Total Pageviews

Sponsor

Sponsor

ad300