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

  • Home
  • SEARCH
  • 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 9203867
In Process

The Archive Base Latest Questions

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

I am new to android. I have a web view which loads a URL.

  • 0

I am new to android. I have a web view which loads a URL. The problem is that after I open the application there is a white screen for 2-3 seconds after that the web view‘s URL is loaded.

I think this is the time the application Initiates. How can I remove the white screen and display my Logo for that time?
I heard of splash screen but in that the logo appears for 1 second then white screen appears for another 2-3 seconds and then finally the web view is loaded.

What am I doing wrong? Is it splash screen or some other way to display the logo while web view loads?

package com.exampe.dating;

import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.view.KeyEvent;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView mywebview = (WebView) findViewById(R.id.webview);
         mywebview.loadUrl("http://www.example.com/mobile/index.php");
         WebSettings webSettings = mywebview.getSettings();
         webSettings.setJavaScriptEnabled(true);
         mywebview.setWebViewClient(new WebViewClient());
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        WebView mywebview = (WebView) findViewById(R.id.webview);
        if ((keyCode == KeyEvent.KEYCODE_BACK) && mywebview.canGoBack()) {
            mywebview.goBack();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}

splashActivity.java

package com.exampe.dating;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;

public class SplashActivity extends Activity {

       private static String TAG = SplashActivity.class.getName();
       private static long SLEEP_TIME = 10;    // Sleep for some time

       @Override
       protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);

          this.requestWindowFeature(Window.FEATURE_NO_TITLE);    // Removes title bar
          this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);    // Removes notification bar

          setContentView(R.layout.splash);

          // Start timer and launch main activity
          IntentLauncher launcher = new IntentLauncher();
          launcher.start();
       }

       private class IntentLauncher extends Thread {
          @Override
          /**
           * Sleep for some time and than start new activity.
           */
          public void run() {
             try {
                // Sleeping
                Thread.sleep(SLEEP_TIME*1000);
             } catch (Exception e) {
                Log.e(TAG, e.getMessage());
             }

             // Start main activity
             Intent intent = new Intent(SplashActivity.this, MainActivity.class);
             SplashActivity.this.startActivity(intent);
             SplashActivity.this.finish();
          }
       }
    }

androidManifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.exampe.dating"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" /> 
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
         <activity
         android:name=".SplashActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>

        <activity
            android:name="com.exampe.dating.MainActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"  >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


    </application>

</manifest>
  • 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-17T23:34:08+00:00Added an answer on June 17, 2026 at 11:34 pm

    It’s very weird to have two launch activities declared in your manifest like that. You should eliminate the intent filter for SplashActivity and just start SplashActivity from within onCreate of your MainActivity:

    EDIT Updated to replace sleeping with waiting. Splash screen will disappear when the page is loaded or when a time-out occurs, whichever comes first.

    public class MainActivity extends Activity {
        public static Object SPLASH_LOCK = new Object();
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
    
            WebView mywebview = (WebView) findViewById(R.id.webview);
            mywebview.loadUrl("http://www.example.com/mobile/index.php");
            WebSettings webSettings = mywebview.getSettings();
            webSettings.setJavaScriptEnabled(true);
            mywebview.setWebViewClient(new WebViewClient());
    
            startActivity(new Intent(this, SplashActivity.class));
        }
        . . .
    }
    
    // in your WebViewClient:
    public void onPageFinished (WebView view, String url) {
        synchronized (SPLASH_LOCK) {
            SPLASH_LOCK.notifyAll();
        }
    }    
    

    Then in SplashActivity, wait the delay you want and just call finish(). You don’t need to start MainActivity again, because it’s sitting behind the SplashActivity and will appear when SplashActivity finishes.

    public class SplashActivity extends Activity {
    
           private static String TAG = SplashActivity.class.getName();
           private static long MAX_SPLASH_TIME = 10000;
    
           @Override
           protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
    
              . . .
    
              setContentView(R.layout.splash);
    
              new Thread() {
                  @Override
                  public void run() {
                      synchronized (MainActivity.SPLASH_LOCK) {
                          // wait for notify or time-out
                          try { MainActivity.SPLASH_LOCK.wait(MAX_SPLASH_TIME); }
                          catch (InterruptedException ignored) {}
                      }
                      finish();
                  }
              }.start();
           }
           . . .
    }
    

    Note that you don’t need the IntentLauncher class.

    P.S. You didn’t ask about this, but if you add this to the SplashActivity tag in your manifest:

    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    

    then you don’t need to call requestWindowFeature or set window flags in onCreate.

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

Sidebar

Related Questions

i am creating a new android application.i am using the table layout. I have
I am new to Android. I have tried an sample application for status bar
I am new to android development. I have created a popup window which is
I have an Android app which I use to register users on my web
I have an Androd application that talks to a back-end web service. As part
I have an android application in which upon clicking netbank icon I am launching
I'm new to android and have been stuck on this problem for a long
I have a very common problem which I think every android developer faces at
I have a application in which i have a preference acitivty which loads my
I have an android application in which i have a hyperlink which opens in

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.