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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:51:24+00:00 2026-05-25T05:51:24+00:00

In my splash screen, I made it so that it detects whether wifi or

  • 0

In my splash screen, I made it so that it detects whether wifi or 3g is enabled or not. If it is not, a dialog screen prompts the user to exit and turn either one on. If it is on, then the code will continue. I keep getting an error in my logcat about my activity having a leaked window. I am not sure how to solve this issue. Code and logcat below. Any Ideas?

Here’s my code:

//create alert dialog for wifi and 3g
connectionDialog = new AlertDialog.Builder(SplashMain.this).create();
Log.d(TAG, "dialog created");
connectionDialog.setTitle("Wifi or 3G not detected. Please enable either Wifi or 3G");
connectionDialog.setButton("Exit", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
            finish();
    }
});

wifiHandler = new Handler();
setContentView(R.layout.splashscreen);  //Make the splash screen load first
Thread splashScreenTimer = new Thread(){ //create a timer for the splash screen
    public void run(){      //create a run class
        Looper.prepare();   //prepare looper
        try{            //methods within the run class
            int screenTimer =0;
            //make it last 3 seconds - create a while loop
            while(screenTimer <3000){
                sleep(100); //100= 1/10th of a second
                screenTimer = screenTimer +100;
            }
            connectionState();  //check wifi stuff
            Log.d(TAG, "checked wifi state");
            if(mobile == true || wifi == true){
                Log.d(TAG, "wifi is true");
                connectionDialog.dismiss();
                startActivity (new Intent("ravebox.dev.sdr.CLEARSCREEN"));
                finish();
                Log.d(TAG, "started activity");
            }
            if(mobile == false || wifi == false){
                Log.d(TAG, "wifi is false");
                wifiHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        Log.d(TAG, "show dialog");
                        connectionDialog.show();
                        Log.d(TAG, "show'd dialog");
                    }
                });
            }//add activity to the manifest
        } catch (InterruptedException e) {
            e.printStackTrace();
        }finally{
            //finish();
        }
    }
};
splashScreenTimer.start();

Log cat:

08-30 22:45:32.188: ERROR/WindowManager(334): Activity ravebox.dev.sdr.SplashMain has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@405377e0 that was originally added here
08-30 22:45:32.188: ERROR/WindowManager(334): android.view.WindowLeaked: Activity ravebox.dev.sdr.SplashMain has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@405377e0 that was originally added here
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.view.ViewRoot.<init>(ViewRoot.java:258)
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.view.Window$LocalWindowManager.addView(Window.java:465)
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.app.Dialog.show(Dialog.java:241)
08-30 22:45:32.188: ERROR/WindowManager(334):     at ravebox.dev.sdr.SplashMain$2$1.run(SplashMain.java:90)
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.os.Handler.handleCallback(Handler.java:587)
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.os.Looper.loop(Looper.java:123)
08-30 22:45:32.188: ERROR/WindowManager(334):     at android.app.ActivityThread.main(ActivityThread.java:3835)
08-30 22:45:32.188: ERROR/WindowManager(334):     at java.lang.reflect.Method.invokeNative(Native Method)
08-30 22:45:32.188: ERROR/WindowManager(334):     at java.lang.reflect.Method.invoke(Method.java:507)
08-30 22:45:32.188: ERROR/WindowManager(334):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-30 22:45:32.188: ERROR/WindowManager(334):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-30 22:45:32.188: ERROR/WindowManager(334):     at dalvik.system.NativeStart.main(Native Method)
  • 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-25T05:51:25+00:00Added an answer on May 25, 2026 at 5:51 am

    Here is an answer that shows why this problem occurs: Activity has leaked window that was originally added

    Now, in you case you have written this code

    if(mobile == true || wifi == true){
          Log.d(TAG, "wifi is true");
          connectionDialog.dismiss();
          startActivity (new Intent("ravebox.dev.sdr.CLEARSCREEN"));
          finish();
          Log.d(TAG, "started activity");
    }
    

    In the above code where are you showing the connectionDialog.dismiss(); before dismissing it.

    And in this code you are showing the dialog by connectionDialog.show(); but where is the code to dismiss it.

    if(mobile == false || wifi == false){
          Log.d(TAG, "wifi is false");
          wifiHandler.post(new Runnable() {
          @Override
          public void run() {
             Log.d(TAG, "show dialog");
             connectionDialog.show();
             Log.d(TAG, "show'd dialog");
          }
    });
    

    So, please find a solution for this, it should be something like this.

    Show the dialog in starting only, if the wifi is connected cancel() it and move to next activity, if not connected cancel() it after sometime and giving a message that wifi not found or connected.

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

Sidebar

Related Questions

I'm creating a splash screen that will display while my Android application loads. I'd
I'm trying to create a splash screen that shows assemblies (all referenced library) loading
I have a label on a splash screen that is displayed for 4 seconds.
I have a splash screen on the application and on that form. I have
The concept of a splash screen doesn't strike me as something that should be
I made a splash screen and used a runnable thread to parse a xml
I'm coding a splash screen in VB.Net that displays for 3 seconds then shows
I want to create a splash screen that will then move to the login/register
I want to make a splash screen in my application, for that i need
I have a splash screen for my program that I want to have a

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.