package com.mfreedial.usa;

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 dial_log extends Activity {

private Button button1,button2;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.dial_log);
setTitle(R.string.dialog_title);

button1 = (Button) findViewById(R.id.dialog_ok);
button2 = (Button) findViewById(R.id.dialog_cancel);

// show();

button1.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {

freecall.WriteBoolean(getApplicationContext(), "flag_info_agreed" , true );
Intent intent = new Intent(Intent.ACTION_MAIN);
intent = new Intent(getApplicationContext(), freecall.class); // intent .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
}

});

button2.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {

String app_pkg_name = getPackageName() ;//"com.mfreedial.usa";
int UNINSTALL_REQUEST_CODE = 1;

Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:" + app_pkg_name));
startActivityForResult(intent, UNINSTALL_REQUEST_CODE);
}
});
}

}

<?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="wrap_content">

<TextView
android:id="@+id/dialog_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/dialog_text"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@id/dialog_info">

<Button
android:id="@+id/dialog_cancel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.50"
android:background="@color/dialog_cancel_bgcolor"
android:text="Cancel"/>

<Button
android:id="@+id/dialog_ok"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.50"
android:background="@color/dialog_ok_bgcolor"
android:text="Agree"/>
</LinearLayout>
</RelativeLayout>