Home > Android > Android Program – Call Dial Activity

Android Program – Call Dial Activity

ANDROID 

Android Program of Call Dial Activity

  

Java Code(DialAct )

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

public class DialAct extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_Dail);
}
public void dial(View v)
{
Intent i=new Intent();
i.setAction(Intent.ACTION_DIAL);
i.setData(Uri.parse(“tel:12345678”));
startActivity(i);
}
public void view1(View v)
{
Intent i=new Intent(this,DialNext.class);
startActivity(i);
}
}

Layout XML Code(activity_Dail)

<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:tools=”http://schemas.android.com/tools”
android:layout_width=”match_parent”
android:orientation=”vertical”
android:layout_height=”match_parent”
android:paddingBottom=”@dimen/activity_vertical_margin”
android:paddingLeft=”@dimen/activity_horizontal_margin”
android:paddingRight=”@dimen/activity_horizontal_margin”
android:paddingTop=”@dimen/activity_vertical_margin”
tools:context=”.DialAct”>

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textSize=”@dimen/textsize”
android:layout_gravity=”center”
android:textStyle=”bold”
android:text=”CALL DIALER”
android:layout_marginBottom=”120dp” />

<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”CALL US”
android:textStyle=”bold”
android:layout_marginBottom=”150dp”
android:onClick=”dial” />

<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/sourcecode”
android:background=”@color/bgcolor”
android:textStyle=”bold”
android:textColor=”@color/text”
android:onClick=”view1″/>

</LinearLayout>


Output

  

Download Source Code

Follow Us – Never Miss Update

Fb/PageTwitterGoogle+InstagramPinterest 


Recent   

[metaslider id=3165]

 

 

Is this Useful content For You?