Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid Black Screen on starting an application

Tags:

android

themes

When I start my application initially, I get a black screen which stays for a few seconds before my main activity starts. In case of iphone an image with name default is displayed for that split second. I'm not sure how to do the same in Android. I tried as below in vain :

         <activity android:name=".Index"
              android:label="@string/app_name"
              android:screenOrientation="portrait"
              android:theme="@drawable/defaultimage">
            <intent-filter>
              <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />
          </intent-filter>
        </activity>  
like image 639
ganesh Avatar asked Apr 06 '10 13:04

ganesh


People also ask

What causes black screen on startup?

We'll look at some things that can cause a black or blank screen: Connection problems with your monitor or screen. Display adapter driver update issues. Issues with recent system updates or installations.

Why does my screen keep going black when I open a game?

Players are reporting that they are getting a black screen while playing games in Windows 10 and 11. This is normally caused by a problem with the graphics card driver. However, it might also be indicative of a graphics card fault, and since most video games require a GPU to run, this is a serious problem.


1 Answers

I guess you have a heavy operation on the onCreate method of your "Index" Activity.

You should put the heavy operations on a thread and make a splash screen with the image, and when the thread is finished, load the menu or whatever you need.

You can make a "loading screen" for example. It's really easy with Android: https://developer.android.com/guide/appendix/faq/commontasks.html#progressbar or https://developer.android.com/reference/android/widget/ProgressBar.html

like image 191
YaW Avatar answered Sep 18 '22 14:09

YaW