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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:22:10+00:00 2026-05-20T07:22:10+00:00

Am I doing it right? I have a Splash screen (just an image), and

  • 0

Am I doing it right?
I have a Splash screen (just an image), and onCreate() I start the main activity after running a heavy function:

SPLASH_DISPLAY_LENGHT=2500;
new Handler().postDelayed(new Runnable(){
public void run() {
     LONG_OPERATING_FUNCTION(); 

     Intent mainIntent = new Intent(this, MainActivity.class); 
     Splash.this.startActivity(mainIntent); 
     Splash.this.finish();
} 
}, SPLASH_DISPLAY_LENGHT);   

    

I think I have a memory leak, and I’m trying to find it.
I don’t think the Splash really is finishing.

  • 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-20T07:22:11+00:00Added an answer on May 20, 2026 at 7:22 am

    LONG_OPERATING_FUNCTION() should not be done on the main application thread, as you have it here.

    Ideally, you do not use a splash screen, but rather only enable selected features of MainActivity while do your LONG_OPERATING_FUNCTION() in an AsyncTask or something.

    If somebody is pointing a gun at your head and forcing you to implement a splash screen lest it be your brains that get, er, splashed, I would do this:

    • Eliminate your Handler and postDelayed() call
    • Replace that with an AsyncTask
    • In doInBackground() of AsyncTask, do your LONG_OPERATING_FUNCTION()
    • If, when LONG_OPERATING_FUNCTION() is done, SPLASH_DISPLAY_LENGHT [sic] time has not elapsed, use SystemClock.sleep() to sleep for the remaining time (or not)
    • In onPostExecute(), start MainActivity and call finish()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a splash screen/loading screen that has .setVisibility() to GONE right after the
Im not sure if I'm doing this right. I have an action that I
I have a problem here. Right now I'm doing my Web Based Application, my
Right, bit of a strange question; I have been doing some linq to XML
So basically I have a GridWorld Project that I'm doing right now in my
I have a main function that contains two dictionaries that I would like to
i have a table Permission : id name desc what i am doing right
I have to simply crop an image. but after cropping the saved image quality
I know you can’t add a class called Socket in VS2010 by doing: Right
I am doing a right join between two datatables in LINQ. I am getting

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.