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 741945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:41:28+00:00 2026-05-14T08:41:28+00:00

I have an application I am creating with a DashboardActivity & a SettingsActivity. On

  • 0

I have an application I am creating with a DashboardActivity & a SettingsActivity. On the dashboard, I have one object displayed, but when I go into settings, I want to be able to select/deselect X options. Once the user clicks the back button, I save that data locally and to the server. Once the phone receives a success message from the server that it was stored properly, I want to reload the dashboard.

I thought I would do this with the onPause and onResume, but they are called when the DashboardActivity is first created. What would be the best way to reload the dashboard by calling my web service after the settings were saved to the server? Here is what I am doing when the back button is hit

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    //Save data to the server once the user hits the back button
    if ((keyCode == KeyEvent.KEYCODE_BACK)) {
        SchoolSearchActivity.this.divisionProxy = new DivisionProxy(SchoolSearchActivity.this.saveUserDivisionHandler);
        SchoolSearchActivity.this.divisionProxy.submitUserDivisions(SchoolSearchActivity.this.userDivisions, SchoolSearchActivity.this.user_id);
        //SchoolSearchActivity.this.finish();
        //Toast.makeText(SchoolSearchActivity.this, "Divisions Saved",Toast.LENGTH_LONG).show();
    }
    return true;
}

The above opens an HTTP connection, and when the response is received, the handler processes the response. I want to:
1) submit the data to the server
2) return to the previous activity
3) show a progress dialog until the response from #1 returns (response handler is in the settings activity; and we are now in the dashboard activity)
4) “refresh” the dashboard

What is the best way to accomplish this so I can just resume the dashboard as it was. Like I said, when I overwrite the onResume method, it is called when the activity is first created. I was considering putting my webservice call in onResume, so it’s called once everytime you make it to the Activity, but it doesn’t seem like the cleanest way.

What would you suggest for 1-4?

  • 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-05-14T08:41:29+00:00Added an answer on May 14, 2026 at 8:41 am

    You could subclass Application and set a flag to show that you’re current cached data is “dirty”. You create your own subclass of Application to store transient global application state which is exactly what you want here. When the user changes their configuration in SettingsActivity you set the flag at the Application level and then in onResume() you can check the flag and only call the web service when you know the user has changed something.

    Alternatively, when you could set your DashboardActivity to have a singleTop launch mode and then use a startActivity() call to move from SettingsActivity to DashboardActivity if settings have changed. If the DashboardActivity is singleTop then a new instance will not be created and the new Intent will be passed to the onNewIntent() method and you can reload your settings there.

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

Sidebar

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.