Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8084937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:56:48+00:00 2026-06-05T17:56:48+00:00

When I get a message I need to bring the activity to front. I

  • 0

When I get a message I need to bring the activity to front. I use the following code:

public void BringToFront()
{
    Intent intent = new Intent();
    intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
    intent.setClass(getApplicationContext(), getClass());
    startActivity(intent);
}

When I get the activity on top the previous data is lost, even though the activity was not killed by the OS. Is there a way to get the activity back without losing the data or I need to recover the data anyway?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:56:50+00:00Added an answer on June 5, 2026 at 5:56 pm

    Your code doesn’t work. Your Activity is only active when it’s in front. If it’s not in front, it can’t process so your method will never be called. An Activity should always save the data it wants to keep, either in onSaveInstanceState or when the data is changed. There’s many ways to save data between activities.
    If you want your activity to be in front, you’ll have to close all activities that are on top of it. If you need these activities again, you should have them save their data, and start them again with the new data.

    I suggest you read the documentation on how Activities work….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With ios4.x I can use code below to get the message when get the
i need to know how to get success message after successful execution of sql
when I use MySQLdb get this message: /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated
Doing code analysis of the project and get the message Reference-counted object is used
I try to use the boolean in my class and get this message reference
I am getting a strange error message with the following piece of PHP code
I know I need to use the . something like .live to get this
If i wanted to get message for ViewData from resource file, depending on the
I get the message Please wait while Windows configures Microsoft Visual Studio 2008... whenever
I am attempting to get the body of an email message using message.get_payload(). However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.