Coming from VB world I learned today that dialogs are not modal in Java. I have the task of converting a program we have written in VB.net for windows based Motorola devices to Java using Android Studio for Android Motorola devices. I am trying to make it as similar to forms in windows. I am at a form that has that has several messageboxes that prompt for input. I tried doing java but noticed that dialogs don't always wait for response. I have read that using dialogfragments can accomplish what I am trying to do. Here is the XML that I had for the first dialog.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackgroundGray"
>
<TextView
android:id="@+id/theText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Holding Text"
android:textAlignment="center"
android:textColor="@color/colorBlack"
android:textSize="30dp" />
<Button
android:id="@+id/buttonYes"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_below="@id/message"
android:layout_margin="8dp"
android:onClick="onClickYes"
android:text="Yes"
android:textSize="26dp" />
<Button
android:id="@+id/buttonNo"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_below="@id/message"
android:layout_margin="8dp"
android:onClick="onClickNo"
android:text="No"
android:textSize="26dp" />
</RelativeLayout>
Here is how I was calling the dialog.
final Dialog dialog = new Dialog(ReturnAreaActivity.this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.setContentView(R.layout.dialog_location);
dialog.setTitle("New Location Setup");
TextView message = (TextView) dialog.findViewById(R.id.theText);
message.setText("Is this location a Pick Bin");
Button buttonYes = (Button) dialog.findViewById(R.id.buttonYes);
Button buttonNo = (Button) dialog.findViewById(R.id.buttonNo);
dialog.show();
Having question on what changes would need to be done to turn the dialog into a dialogFragment. I appreciate and clarity anyone can shed. Also the calling of the dialogFragments would be done during a loop
Thanks