Chi*_*era 8 java android android-layout android-dialog
I'm fairly new to Android development and I've created my first "real" application that does the following:
MainActivity processes Extra Data and then displays a ViewDialog
that extends Dialog
. ViewDialog
has a showDialog()
method that does the following to setup and display the Dialog
:
protected void showDialog(final Activity activity)
{
dialog = new Dialog(activity);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(false);
dialog.setContentView(dialog_layout);
// Set background color of the dialog
ConstraintLayout currentLayout = (ConstraintLayout) dialog.findViewById(R.id.Dialog);
// setup of views etc ...
// Finally dislay `Dialog`
dialog.show();
// Method called to start a `DialogTimer` which extends `CountDownTimer`
}
Run Code Online (Sandbox Code Playgroud)MainActivity shows the ViewDialog
as follows:
public class MainActivity extends AppCompatActivity {
private static Context appContext;
private static ViewDialog notify;
protected void onCreate(Bundle savedInstanceState) {
// methods and processing etc...
// time to display dialog
notify = new ViewDialog(mParameters, mThemeHandler );
// ******************** Show dialog box *******************
notify.showDialog(activity: this); // showDialog just calls `Dialog.show()`
notify.ApplyTheme();
}
Run Code Online (Sandbox Code Playgroud)When the timer expires or the user presses a button the ViewDialog
is closed and the application is finished with the following code:
mButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CancelTimer();
activity.finishAndRemoveTask();
dialog.dismiss();
Run Code Online (Sandbox Code Playgroud)The problem is that when the ViewDialog
is dismissed I can occasionally see what looks like a message that is displaying the activities android:label
that is setup in the AndroidManifest file.
I'm not sure why this happens, but I assume it's displaying some item of the MainActivity
layout when the ViewDialog
closes that uses it's own dialog_layout
layout file.
I've fiddled with so many different things and changed code/layouts etc and I haven't been able to find my error.
What are some pointers and hints that will help me fix this? I'm happy to provide more details if needed.
The layout and manifest files are here:
事实证明,如果我改变:
public class MainActivity extends AppCompatActivity {
Run Code Online (Sandbox Code Playgroud)
到
public class MainActivity extends Activity {
Run Code Online (Sandbox Code Playgroud)
问题就消失了。我不知道为什么,但我会接受它。
归档时间: |
|
查看次数: |
289 次 |
最近记录: |