Search code examples
androidandroid-imageviewsplash-screen

splashscreen imageview not displaying images


Hi guys i have this splash screen with the layout main.xml which contains an imageview, here is the main.xml file

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/slide11" />
</LinearLayout>

and here is my splashscreen.class file

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
 try {  
           new Handler().postDelayed(new Runnable() {
            public void run() 
            Intent intent = new Intent(getApplicationContext(),content_activity.class);
            startActivity(intent);
            Main.this.finish();   }  }, 5000);
            } catch(Exception e){}
}
 @Override
public void onBackPressed() {

        super.onBackPressed();
} }

when i try to run this in my emulator all works fine, but when i try to run it in a device through debugging mode i don't get the image specified in the imageView, but i get a white screen for the specified amount of time.any help would be much appreciated.

//edit : i double checked the res/drawable folder and i tried primarily using png and also gave a go using .gif none worked in the device. (device micromax a110)


Solution

  • looks like it was because of the size of the image, when reduced worked !!