Second Activity Opens After the HOME button is pressed Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to check if activity is in foreground or in visible background?Removing an activity from the history stackOn logout, clear Activity history stack, preventing “back” button from opening logged-in-only ActivitiesResume to sub activity after home is pressedWhich method is run when Home button pressed?State of calling activity after startActivityForResult and Home key is pressedhow to make home activity visible after login activity kill and home button pressedActivity Destroy method gets called on long pressing device home?Android App opens second instance when “launched” after back button pressedAndroid app opens after a few seconds after pressing home button during splash screenOpen recent activity on app icon press , after pressing the home key of device
malloc in main() or malloc in another function: allocating memory for a struct and its members
What is the proper term for etching or digging of wall to hide conduit of cables
Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?
Did any compiler fully use 80-bit floating point?
Releasing Patch File for BSD3 Licensed Project
As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?
How can I prevent/balance waiting and turtling as a response to cooldown mechanics
Is this Kuo-toa homebrew race balanced?
Is the time—manner—place ordering of adverbials an oversimplification?
Weaponising the Grasp-at-a-Distance spell
Is this Half dragon Quaggoth Balanced
Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?
Why BitLocker does not use RSA
Determine whether an integer is a palindrome
Does the transliteration of 'Dravidian' exist in Hindu scripture? Does 'Dravida' refer to a Geographical area or an ethnic group?
Order between one to one functions and their inverses
Is it OK to use the testing sample to compare algorithms?
Putting class ranking in CV, but against dept guidelines
Why not use the yoke to control yaw, as well as pitch and roll?
One-one communication
Twin's vs. Twins'
Fit odd number of triplets in a measure?
How to ask rejected full-time candidates to apply to teach individual courses?
What does 丫 mean? 丫是什么意思?
Second Activity Opens After the HOME button is pressed
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to check if activity is in foreground or in visible background?Removing an activity from the history stackOn logout, clear Activity history stack, preventing “back” button from opening logged-in-only ActivitiesResume to sub activity after home is pressedWhich method is run when Home button pressed?State of calling activity after startActivityForResult and Home key is pressedhow to make home activity visible after login activity kill and home button pressedActivity Destroy method gets called on long pressing device home?Android App opens second instance when “launched” after back button pressedAndroid app opens after a few seconds after pressing home button during splash screenOpen recent activity on app icon press , after pressing the home key of device
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
In my application I have a SplashScreen which is opened when the app is launched. And after 1 second the Login activity is opened. But I have an issue when the HOME button is pressed right after the app is launched. If I tap on the HOME button, only when the splash screen is visible, the app closes but after a few seconds (aprox. 2 sec) the Login activity opens even if the app is not visible anymore (it is alive only in the back stack).
Here is how I start the Login activity:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
And this is the startLoginActivity() method:
Intent intent = new Intent(activity, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
// Finish the calling activity
activity.finish();
How could I fix this?
add a comment |
In my application I have a SplashScreen which is opened when the app is launched. And after 1 second the Login activity is opened. But I have an issue when the HOME button is pressed right after the app is launched. If I tap on the HOME button, only when the splash screen is visible, the app closes but after a few seconds (aprox. 2 sec) the Login activity opens even if the app is not visible anymore (it is alive only in the back stack).
Here is how I start the Login activity:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
And this is the startLoginActivity() method:
Intent intent = new Intent(activity, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
// Finish the calling activity
activity.finish();
How could I fix this?
add a comment |
In my application I have a SplashScreen which is opened when the app is launched. And after 1 second the Login activity is opened. But I have an issue when the HOME button is pressed right after the app is launched. If I tap on the HOME button, only when the splash screen is visible, the app closes but after a few seconds (aprox. 2 sec) the Login activity opens even if the app is not visible anymore (it is alive only in the back stack).
Here is how I start the Login activity:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
And this is the startLoginActivity() method:
Intent intent = new Intent(activity, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
// Finish the calling activity
activity.finish();
How could I fix this?
In my application I have a SplashScreen which is opened when the app is launched. And after 1 second the Login activity is opened. But I have an issue when the HOME button is pressed right after the app is launched. If I tap on the HOME button, only when the splash screen is visible, the app closes but after a few seconds (aprox. 2 sec) the Login activity opens even if the app is not visible anymore (it is alive only in the back stack).
Here is how I start the Login activity:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
And this is the startLoginActivity() method:
Intent intent = new Intent(activity, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
// Finish the calling activity
activity.finish();
How could I fix this?
edited Mar 9 at 0:35
halfer
14.8k759118
14.8k759118
asked Feb 27 '14 at 14:11
LauraLaura
1,41352245
1,41352245
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You should add check if splash activity is visible:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
if (SplashActivity.isVisible())
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
SplashActivity.isVisible() method can be implemented as described here: How to check if activity is in foreground or in visible background?
Thank you very much. Your link helped me a lot. Now it seems to work fine. Thanks again :)
– Laura
Feb 27 '14 at 15:58
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%2f22071061%2fsecond-activity-opens-after-the-home-button-is-pressed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should add check if splash activity is visible:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
if (SplashActivity.isVisible())
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
SplashActivity.isVisible() method can be implemented as described here: How to check if activity is in foreground or in visible background?
Thank you very much. Your link helped me a lot. Now it seems to work fine. Thanks again :)
– Laura
Feb 27 '14 at 15:58
add a comment |
You should add check if splash activity is visible:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
if (SplashActivity.isVisible())
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
SplashActivity.isVisible() method can be implemented as described here: How to check if activity is in foreground or in visible background?
Thank you very much. Your link helped me a lot. Now it seems to work fine. Thanks again :)
– Laura
Feb 27 '14 at 15:58
add a comment |
You should add check if splash activity is visible:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
if (SplashActivity.isVisible())
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
SplashActivity.isVisible() method can be implemented as described here: How to check if activity is in foreground or in visible background?
You should add check if splash activity is visible:
Handler handler = new Handler();
handler.postDelayed(new Runnable()
public void run()
if (SplashActivity.isVisible())
// Show login screen
Utility.startLoginActivity(SplashScreenActivity.this);
, 1000);
SplashActivity.isVisible() method can be implemented as described here: How to check if activity is in foreground or in visible background?
edited May 23 '17 at 12:03
Community♦
11
11
answered Feb 27 '14 at 14:59
birdybirdy
4,70713052
4,70713052
Thank you very much. Your link helped me a lot. Now it seems to work fine. Thanks again :)
– Laura
Feb 27 '14 at 15:58
add a comment |
Thank you very much. Your link helped me a lot. Now it seems to work fine. Thanks again :)
– Laura
Feb 27 '14 at 15:58
Thank you very much. Your link helped me a lot. Now it seems to work fine. Thanks again :)
– Laura
Feb 27 '14 at 15:58
Thank you very much. Your link helped me a lot. Now it seems to work fine. Thanks again :)
– Laura
Feb 27 '14 at 15:58
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%2f22071061%2fsecond-activity-opens-after-the-home-button-is-pressed%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