Android - Popup dialog on home/native screens
Newbie here. I know this question has been asked for many times, but
there's no full picture on the solution so far. I first started to run
some code without GUI, which is successful by simply setting the theme.
Now, I want to add dialog to display error from the code.
<activity android:name="PopupActivity"
android:launchMode="singleInstance" android:excludeFromRecents="true"
android:taskAffinity="" android:theme="@android:style/Theme.Dialog" />
So I created an empty view with wrap_content as width and height, but I'm
not sure what view element I should use for the AlertDialog object in the
activity. I have tested all my code in another activity with a view,
everything works fine, AlertDialog shows without problem.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
</LinearLayout>
Is there a simple solution? Or I have to treat the Theme.Dialog view as a
normal view and add textview and button to emulate a dialog?
I uses AlertDialog.Builder for the dialog creation:
AlertDialog.Builder alertDialogB = new AlertDialog.Builder(cont);
alertDialogB.setTitle(title);
alertDialogB.setMessage(msg);
...
...
IDE: IntelliJ SDK: 4.1.2
No comments:
Post a Comment