Is is possible to keep alert dialog displayed after activity is destroyed?How do I display an alert dialog on Android?How to display a Yes/No dialog box on Android?Background task, progress dialog, orientation change - is there any 100% working solution?ViewPager and fragments — what's the right way to store fragment's state?Android: show Alert Dialog at any activityAndroid destroying activities, killing processesAndroid alert dialog IssueDisplay Alert Dialog when Activity onPause()How to programmatically open the Permission Screen for a specific app on Android Marshmallow?Showing Alert Dialog after Notification button tap
Lifted its hind leg on or lifted its hind leg towards?
Freedom of speech and where it applies
What was required to accept "troll"?
Giant Toughroad SLR 2 for 200 miles in two days, will it make it?
Why are all the doors on Ferenginar (the Ferengi home world) far shorter than the average Ferengi?
Is there an wasy way to program in Tikz something like the one in the image?
Should my PhD thesis be submitted under my legal name?
Hostile work environment after whistle-blowing on coworker and our boss. What do I do?
Calculating the number of days between 2 dates in Excel
I2C signal and power over long range (10meter cable)
Bob has never been a M before
Invariance of results when scaling explanatory variables in logistic regression, is there a proof?
In Star Trek IV, why did the Bounty go back to a time when whales were already rare?
Pronouncing Homer as in modern Greek
Can somebody explain Brexit in a few child-proof sentences?
Can I use my Chinese passport to enter China after I acquired another citizenship?
What does the "3am" section means in manpages?
Identify a stage play about a VR experience in which participants are encouraged to simulate performing horrific activities
The One-Electron Universe postulate is true - what simple change can I make to change the whole universe?
Can a Bard use an arcane focus?
Can a malicious addon access internet history and such in chrome/firefox?
Simple image editor tool to draw a simple box/rectangle in an existing image
Why does this part of the Space Shuttle launch pad seem to be floating in air?
Is there any significance to the Valyrian Stone vault door of Qarth?
Is is possible to keep alert dialog displayed after activity is destroyed?
How do I display an alert dialog on Android?How to display a Yes/No dialog box on Android?Background task, progress dialog, orientation change - is there any 100% working solution?ViewPager and fragments — what's the right way to store fragment's state?Android: show Alert Dialog at any activityAndroid destroying activities, killing processesAndroid alert dialog IssueDisplay Alert Dialog when Activity onPause()How to programmatically open the Permission Screen for a specific app on Android Marshmallow?Showing Alert Dialog after Notification button tap
I have a business logic that requires to keep an alert dialog displayed when a transition happens and an activity is destroyed and another one created.
The activity that is destroyed is the one that starts the alert dialog.
I did some research on my own and did not find any reliable solution.
If you know a solution or some workarounds that could help me that will be great.
add a comment |
I have a business logic that requires to keep an alert dialog displayed when a transition happens and an activity is destroyed and another one created.
The activity that is destroyed is the one that starts the alert dialog.
I did some research on my own and did not find any reliable solution.
If you know a solution or some workarounds that could help me that will be great.
why not you show your alert dialog in second activity(which is visible) ?
– Jakir Hossain
Mar 8 at 7:59
it is required to be displayed on both. because it should be displayed some time on first activity and some time after the second activity is started
– MihaiBC
Mar 8 at 8:01
take 1 activity and screens as fragments , show dialog in activity
– Manohar Reddy
Mar 8 at 9:05
Is it implemented now
– Leo Zhu - MSFT
Mar 22 at 9:17
add a comment |
I have a business logic that requires to keep an alert dialog displayed when a transition happens and an activity is destroyed and another one created.
The activity that is destroyed is the one that starts the alert dialog.
I did some research on my own and did not find any reliable solution.
If you know a solution or some workarounds that could help me that will be great.
I have a business logic that requires to keep an alert dialog displayed when a transition happens and an activity is destroyed and another one created.
The activity that is destroyed is the one that starts the alert dialog.
I did some research on my own and did not find any reliable solution.
If you know a solution or some workarounds that could help me that will be great.
asked Mar 8 at 7:50
MihaiBCMihaiBC
498
498
why not you show your alert dialog in second activity(which is visible) ?
– Jakir Hossain
Mar 8 at 7:59
it is required to be displayed on both. because it should be displayed some time on first activity and some time after the second activity is started
– MihaiBC
Mar 8 at 8:01
take 1 activity and screens as fragments , show dialog in activity
– Manohar Reddy
Mar 8 at 9:05
Is it implemented now
– Leo Zhu - MSFT
Mar 22 at 9:17
add a comment |
why not you show your alert dialog in second activity(which is visible) ?
– Jakir Hossain
Mar 8 at 7:59
it is required to be displayed on both. because it should be displayed some time on first activity and some time after the second activity is started
– MihaiBC
Mar 8 at 8:01
take 1 activity and screens as fragments , show dialog in activity
– Manohar Reddy
Mar 8 at 9:05
Is it implemented now
– Leo Zhu - MSFT
Mar 22 at 9:17
why not you show your alert dialog in second activity(which is visible) ?
– Jakir Hossain
Mar 8 at 7:59
why not you show your alert dialog in second activity(which is visible) ?
– Jakir Hossain
Mar 8 at 7:59
it is required to be displayed on both. because it should be displayed some time on first activity and some time after the second activity is started
– MihaiBC
Mar 8 at 8:01
it is required to be displayed on both. because it should be displayed some time on first activity and some time after the second activity is started
– MihaiBC
Mar 8 at 8:01
take 1 activity and screens as fragments , show dialog in activity
– Manohar Reddy
Mar 8 at 9:05
take 1 activity and screens as fragments , show dialog in activity
– Manohar Reddy
Mar 8 at 9:05
Is it implemented now
– Leo Zhu - MSFT
Mar 22 at 9:17
Is it implemented now
– Leo Zhu - MSFT
Mar 22 at 9:17
add a comment |
3 Answers
3
active
oldest
votes
I usually build my dialog by giving it a reference to the current activity. And that's how at least what the guide tells us to do. So my quick answer is NO YOU CAN'T.
However an alternative is in place. Instead of creating two different activities, put them in two different fragments. Load them in one single activity where you can hook your dialog. From your activity, you can switch between your two fragments without the need to close your dialog since the activity won't destroy upon fragment switch.
that was the solution i thought first but the current implementation requires to much refactor in order to change it, but that will probably be the solution
– MihaiBC
Mar 8 at 8:25
we all have that one boss who does not understand our pain. :)
– user1506104
Mar 8 at 8:27
add a comment |
This is my suggestion for reference only
as allowed,you could run a full transparent Activity first,then set the Dialog to system level,and instantiation Dialgo in your custom application,and you could show and dismiss the Dialog by your application
like this hierarchy : TransparentActivity(MainLauncher activity) -> Activity1 -> Activity2
you could show Dialog when Activity1 destroy and dismiss it when Activity2 create by your application.
In fact, Dialog is attached to TransparentActivity,so you should override the back button event to prevent returning to TransparentActivity.
add a comment |
You can try this way
public abstract class BaseActivity extends AppCompatActivity
protected void showProgressDialog(String message)
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setCancelable(false);
alert.setTitle("your title");
alert.setMessage(message);
alert.create().show();
Extends this BaseActivity in your both Activity.
call showProgressDialog() method to show your alert message in FirstActivity and when FirstActivity is Destroyed then Call it from SecondActivity.
Hope it will help you. Happy Coding.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058841%2fis-is-possible-to-keep-alert-dialog-displayed-after-activity-is-destroyed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I usually build my dialog by giving it a reference to the current activity. And that's how at least what the guide tells us to do. So my quick answer is NO YOU CAN'T.
However an alternative is in place. Instead of creating two different activities, put them in two different fragments. Load them in one single activity where you can hook your dialog. From your activity, you can switch between your two fragments without the need to close your dialog since the activity won't destroy upon fragment switch.
that was the solution i thought first but the current implementation requires to much refactor in order to change it, but that will probably be the solution
– MihaiBC
Mar 8 at 8:25
we all have that one boss who does not understand our pain. :)
– user1506104
Mar 8 at 8:27
add a comment |
I usually build my dialog by giving it a reference to the current activity. And that's how at least what the guide tells us to do. So my quick answer is NO YOU CAN'T.
However an alternative is in place. Instead of creating two different activities, put them in two different fragments. Load them in one single activity where you can hook your dialog. From your activity, you can switch between your two fragments without the need to close your dialog since the activity won't destroy upon fragment switch.
that was the solution i thought first but the current implementation requires to much refactor in order to change it, but that will probably be the solution
– MihaiBC
Mar 8 at 8:25
we all have that one boss who does not understand our pain. :)
– user1506104
Mar 8 at 8:27
add a comment |
I usually build my dialog by giving it a reference to the current activity. And that's how at least what the guide tells us to do. So my quick answer is NO YOU CAN'T.
However an alternative is in place. Instead of creating two different activities, put them in two different fragments. Load them in one single activity where you can hook your dialog. From your activity, you can switch between your two fragments without the need to close your dialog since the activity won't destroy upon fragment switch.
I usually build my dialog by giving it a reference to the current activity. And that's how at least what the guide tells us to do. So my quick answer is NO YOU CAN'T.
However an alternative is in place. Instead of creating two different activities, put them in two different fragments. Load them in one single activity where you can hook your dialog. From your activity, you can switch between your two fragments without the need to close your dialog since the activity won't destroy upon fragment switch.
answered Mar 8 at 8:15
user1506104user1506104
1,52522144
1,52522144
that was the solution i thought first but the current implementation requires to much refactor in order to change it, but that will probably be the solution
– MihaiBC
Mar 8 at 8:25
we all have that one boss who does not understand our pain. :)
– user1506104
Mar 8 at 8:27
add a comment |
that was the solution i thought first but the current implementation requires to much refactor in order to change it, but that will probably be the solution
– MihaiBC
Mar 8 at 8:25
we all have that one boss who does not understand our pain. :)
– user1506104
Mar 8 at 8:27
that was the solution i thought first but the current implementation requires to much refactor in order to change it, but that will probably be the solution
– MihaiBC
Mar 8 at 8:25
that was the solution i thought first but the current implementation requires to much refactor in order to change it, but that will probably be the solution
– MihaiBC
Mar 8 at 8:25
we all have that one boss who does not understand our pain. :)
– user1506104
Mar 8 at 8:27
we all have that one boss who does not understand our pain. :)
– user1506104
Mar 8 at 8:27
add a comment |
This is my suggestion for reference only
as allowed,you could run a full transparent Activity first,then set the Dialog to system level,and instantiation Dialgo in your custom application,and you could show and dismiss the Dialog by your application
like this hierarchy : TransparentActivity(MainLauncher activity) -> Activity1 -> Activity2
you could show Dialog when Activity1 destroy and dismiss it when Activity2 create by your application.
In fact, Dialog is attached to TransparentActivity,so you should override the back button event to prevent returning to TransparentActivity.
add a comment |
This is my suggestion for reference only
as allowed,you could run a full transparent Activity first,then set the Dialog to system level,and instantiation Dialgo in your custom application,and you could show and dismiss the Dialog by your application
like this hierarchy : TransparentActivity(MainLauncher activity) -> Activity1 -> Activity2
you could show Dialog when Activity1 destroy and dismiss it when Activity2 create by your application.
In fact, Dialog is attached to TransparentActivity,so you should override the back button event to prevent returning to TransparentActivity.
add a comment |
This is my suggestion for reference only
as allowed,you could run a full transparent Activity first,then set the Dialog to system level,and instantiation Dialgo in your custom application,and you could show and dismiss the Dialog by your application
like this hierarchy : TransparentActivity(MainLauncher activity) -> Activity1 -> Activity2
you could show Dialog when Activity1 destroy and dismiss it when Activity2 create by your application.
In fact, Dialog is attached to TransparentActivity,so you should override the back button event to prevent returning to TransparentActivity.
This is my suggestion for reference only
as allowed,you could run a full transparent Activity first,then set the Dialog to system level,and instantiation Dialgo in your custom application,and you could show and dismiss the Dialog by your application
like this hierarchy : TransparentActivity(MainLauncher activity) -> Activity1 -> Activity2
you could show Dialog when Activity1 destroy and dismiss it when Activity2 create by your application.
In fact, Dialog is attached to TransparentActivity,so you should override the back button event to prevent returning to TransparentActivity.
answered Mar 13 at 4:39
Leo Zhu - MSFTLeo Zhu - MSFT
1,141118
1,141118
add a comment |
add a comment |
You can try this way
public abstract class BaseActivity extends AppCompatActivity
protected void showProgressDialog(String message)
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setCancelable(false);
alert.setTitle("your title");
alert.setMessage(message);
alert.create().show();
Extends this BaseActivity in your both Activity.
call showProgressDialog() method to show your alert message in FirstActivity and when FirstActivity is Destroyed then Call it from SecondActivity.
Hope it will help you. Happy Coding.
add a comment |
You can try this way
public abstract class BaseActivity extends AppCompatActivity
protected void showProgressDialog(String message)
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setCancelable(false);
alert.setTitle("your title");
alert.setMessage(message);
alert.create().show();
Extends this BaseActivity in your both Activity.
call showProgressDialog() method to show your alert message in FirstActivity and when FirstActivity is Destroyed then Call it from SecondActivity.
Hope it will help you. Happy Coding.
add a comment |
You can try this way
public abstract class BaseActivity extends AppCompatActivity
protected void showProgressDialog(String message)
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setCancelable(false);
alert.setTitle("your title");
alert.setMessage(message);
alert.create().show();
Extends this BaseActivity in your both Activity.
call showProgressDialog() method to show your alert message in FirstActivity and when FirstActivity is Destroyed then Call it from SecondActivity.
Hope it will help you. Happy Coding.
You can try this way
public abstract class BaseActivity extends AppCompatActivity
protected void showProgressDialog(String message)
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setCancelable(false);
alert.setTitle("your title");
alert.setMessage(message);
alert.create().show();
Extends this BaseActivity in your both Activity.
call showProgressDialog() method to show your alert message in FirstActivity and when FirstActivity is Destroyed then Call it from SecondActivity.
Hope it will help you. Happy Coding.
edited Mar 8 at 8:34
answered Mar 8 at 8:11
Jakir HossainJakir Hossain
998
998
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058841%2fis-is-possible-to-keep-alert-dialog-displayed-after-activity-is-destroyed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
why not you show your alert dialog in second activity(which is visible) ?
– Jakir Hossain
Mar 8 at 7:59
it is required to be displayed on both. because it should be displayed some time on first activity and some time after the second activity is started
– MihaiBC
Mar 8 at 8:01
take 1 activity and screens as fragments , show dialog in activity
– Manohar Reddy
Mar 8 at 9:05
Is it implemented now
– Leo Zhu - MSFT
Mar 22 at 9:17