I am developing an app in which i have to show a button on the screen which is shown in the screenshot. But i want to show this button on some other activity. e.g. I have an activity which is on the screen. now after two minutes i want to show a custom alert dialog i.e. this screen which is shown in the screenshot but instead of showing only button, the alert dialog is showing whole screen as a dialog i.e with the white background. How can i get rid of this background so that only this button can be shown on the screen as an alert dialog? My code for this custom layout is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:text="Unable to Snooze"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dp"
android:id="@+id/button"
android:background="#088a68"
android:textColor="#FFFFFF"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp" />
and activity code for alert dialog is:
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ActivityA.this);
LayoutInflater inflater = ActivityA.this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.alert, null);
dialogBuilder.setView(dialogView);
AlertDialog alert11 = dialogBuilder.create();
alert11.show();
}
}, 120000);
NOTE I want to show the button on the bottom of the screen as an alertdialog