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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:07:32+00:00 2026-06-17T01:07:32+00:00

I am developing an Android application with number of activities. My MainActivity (Starting activity)

  • 0

I am developing an Android application with number of activities. My MainActivity (Starting activity) has code to fetch updated data from server. I want to fetch updated data from server every time user launch application (1st launch or move application in foreground).
1st launch is fine i fetch data. But when user is on some other activity and minimize my app and open again it starts from last state. At this point how can i detect application is starting again so that i can fetch data again.

I have already checked onResume(), onPause() methods but they belong to individual activities. I want to catch event on application level, as we normally do in iOS applications.

  • 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-17T01:07:34+00:00Added an answer on June 17, 2026 at 1:07 am

    AFAIK you can’t. You’ll have to find a way to filter the onResume()/onPause() from all the activities to find out the application went to background.

    A suggestion:

     public abstract class AbstractActivity extends Activity{
        private static long pauseTime=0;
        private static final long MIN_PAUSE_TIME = 3000;
    
        protected void onPause(){
          super.onPause();
          pauseTime = System.currentTimeMillis();
        }
    
        protected void onResume(){
          super.onResume();
          if(System.currentTimeMillis()-pauseTime > MIN_PAUSE_TIME){
             // do server stuff
          }
        }
     }
    

    and then make all your activities extend this one.

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

Sidebar

Related Questions

I am developing an Android application. This app deals with contact information (name, number,
I am developing android application in which i have to open option menu from
I'm developing an Android application. On one activity I have a List with list
I am developing Android Application having ContactUs Page having Phone Number. I had given
I have been developing a number of Android activities in a project in Eclipse.
I'm developing a mobile application for android. There, I creating socket and transfer data
The code (android application) I am developing receives an SMS and if the SMS
I am developing an application on android, and there is a proxy server in
i am developing android messaging application i need to know port number of emulator
I am developing android application.In my application I want to display images from sd

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.