why my splash screen don't show the images?

splash screen examples
android splash screen
splash screen animation
splash screen generator
splash screen with login page in android
full screen splash screen android
splash screen windows
splash screen not showing android

I've created one splash screen with android studio 0.1, but when I test it on my phone(nexus s) in debugging mode with usb the image isn't show.. why?

this is the MainActivity

package com.example.splash;

import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.os.Handler;
import android.view.Menu;

public class MainActivity extends Activity {

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

    Handler x = new Handler();
    x.postDelayed(new SplashHandler(), 7000);



}
class SplashHandler implements Runnable{

    public void run(){


     startActivity(new Intent(getApplication(), Main.class));
        MainActivity.this.finish();


    }


}


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

}

this is Main

package com.example.splash;


import android.app.Activity;

public class Main extends Activity {   

}

this is Splash.xml

< ?xml version="1.0" encoding="utf-8"?>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:orientation="vertical"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" android:background="@drawable/splash">

</LinearLayout>

Don't use a application context. To know when to use activity context and application context pls check the link below especially the answer by commonsware

When to call activity context OR application context?

I tested your code in the post. It works on my device samsung galaxy s3. Only Change i made was having a imageview in the RelativeLayout and set the image for the same in onCreate(). I also used a activity context. Other than that your code is fine.

Splash screen using handler

public class Splash extends Activity {
private static final int SPLASH_TIME = 2 * 1000;// 3 seconds delay

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    ImageView iv= (ImageView) findViewById(R.id.imageView1);
    iv.setBackgroundResource(R.drawable.afor);
    try {
           new Handler().postDelayed(new Runnable() {

        public void run() {

            Intent intent = new Intent(Splash.this,
                MainActivity.class);
            startActivity(intent);

            Splash.this.finish();
        }     
    }, SPLASH_TIME);
        }

    } catch(Exception e){}
}
 @Override
public void onBackPressed() {
    this.finish();
    super.onBackPressed();
}
}

splash.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" android:background="#ffffaa">

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_centerInParent="true"
     />

 </RelativeLayout>

Building the perfect splash screen, be quick. How quick? As quick as possible, but never more than 2 or 3 seconds. Any user who uses your app regularly will quickly get frustrated if they have to sit around and wait for an app to open for more than a few seconds. In most cases being stuck at the Splash Screen is due to faulty Windows Updates. Those Updates may be corrupt, did not install completely or correctly or just disable or enable some functions on a computer that could stop a machine from working.

Try to change

Class c extends Activity to Class c extends AppCompatActivity.

Works to me.

How do I disable my computer BIOS splash screen?, From a design perspective, the splash screen sets the scene for the rest of the app, inviting your This is your chance to impress. In those precious 3 seconds (or less) your user doesn't have time to digest multiple pieces of  A splash screen is an image you can see when app or web page is loading. Usually, you see the full screen covered with an animated picture or logo of a specific brand. it is a well-thought marketing approach since it is the start of your first acquaintance with the app loading.

Try this code

MainActivity

public class MainActivity extends Activity {

String EmpID;
int requestCode;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.splash);          
    Thread timer = new Thread() {
        public void run() {
            try {
                sleep(2500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
                startActivity(new Intent(getApplication(), Main.class));
                 MainActivity.this.finish();
            }
        }
    };
    timer.start();
   }
}

Splash.xml Remember splash image should be png

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" 
android:background="@drawable/splash">

The Magic of the Splash Screen, Learn what a splash screen is, when to use them, and how they can and it doesn't load or I press the back button on my Nexus and I don't  If you took the time to invest in solid logo design, why not take that to the next level and include an animated version on your splash screen. For example, If your branded logo uses cursive text, a simple animation that shows the text as if it were written in front of the user’s eyes is a clever yet simple way to capture the user’s attention.

Change splash screen in iOS app for dummies (the better way), Forget about adding images for splash screen (launch screen) with different In my case (React Native app) it will be os/hoppycar 3) If there is selected something in Launch Images Source (General tab), choose Don't use  Remove the <intent-filter> from the MainActivity if you want the SplashActivity to be the entry point of your application. Splash screen activity does not showing You have two icons for your app in the launcher at the moment. You need to open the SplashActivity instead of the MainActivity

Splash Screen, o Don't write important text on the splash screen. o Do add your logo and tagline to the screen for branding and marketing. o  Ryujingt3Trusted MemberQ&A Team. This is now standard for all mailboxes using Outlook.com. It only takes a few seconds. It may be that something is happening behind the scenes that we are not privy

Why can't I remove the Splash Screen from my build? – Unity, I am sorry to hear that you are having issues with regards to deploying your WebGL project with a splash screen. Please don't hesitate to contact  Usually, the splash screen can include a logo or another image, as well as a company name, and sometimes the company's slogan. The picture below shows an example of the BIOS splash screen for a Dell computer. A splash screen can also be used on websites.

Comments
  • Are you sure you Have you copied the image to this folder
  • What's the name of the image file? splash or splash.jpg?
  • the image is in the folder and it's png, the name is splash
  • @powerj1984 i agree with you the splash screen does nothing and it is not required in this case. read the whole article in both blog links posted by me and yours.
  • I read the article and I realized that It was not a good idea! I wanted to use it only to not show the menu directly, because aesthetically I did not like!
  • i read somewhere on SO that sleep inside a thread is not a good design.
  • Could be not sure. But never created a prblm for me as there is try, catch and finally..
  • the image still does not appear.
  • i am not talking about the problem you can search on SO to be sure. I only said its a bad design
  • @Malloc try the below. the answer works on my phone and pls use a activity context. to know why check the link posted by me in the answer