AIDE Tutorial - 58 Call Action Button
Watch the video belowMain 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>
android:onClick="call"
android:text="Call" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
MainActivity.java
package com.kcgroup.callaction;
package com.kcgroup.callaction;
import android.app.*;
import android.os.*;
import android.view.*;
import android.content.*;
import android.net.*;
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);
}
}
{
@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"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
0 comments:
Post a Comment