How to avoid black screen in android while loading my application?

How to avoid black screen in android while loading my application? I removed all things from onCreate in AsyncTask, but still I have a black screen at the beginning. My default activity (first) is Main, and if there is one parameter, I instantly load a personal activity with the Main showing, otherwise I show Main activity. Can someone suggest me a solution? I tried with http://blog.iangclifton.com/2011/01/01/android-splash-screens-done-right/ , but this does not help.

+6
source share
4 answers

I'm not sure.

but try this in the manifest .. inside your activity

android: theme = "@android: style / Theme.Translucent"

Or

Android: theme = "@ android: style /Theme.Light"

I saw a good splash screen solution ... hope this is helpful

fooobar.com/questions/905696 / ...

+19
source

Add the line below to the android style.xml file in the style tag.

<item name="android:windowDisablePreview">true</item> 

Full code:

  <style name="AppBaseTheme" parent="android:Theme.Light.NoTitleBar"> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> <item name="android:windowDisablePreview">true</item> </style> 
+8
source

Optimize ur code, try to reduce the code from onCreate (), this is the problem I encountered, I solved it by reducing the code in onCreate ().

Best of luck

+2
source

Since you cleared your onCreate () and assigned your initialization tasks to the workflow, the fact that your screen still remains dark for a while after starting your application is probably due to the complexity of the graphics in your initial (and not your initialization code, which is probably related to the model, not related to viewing).

The solution that you think worked for you is to use the visible background as the theme. I am glad that you found this adequate, but for some purposes a more specific (for example, application logo / name) screensaver (which quickly displays because it uses much simpler graphics) would be more desirable.

Please see the answer below for a detailed description (with sample code) of how to quickly display the splash screen:

Create a real screensaver

This also discusses the approach you took above.

0
source

Source: https://habr.com/ru/post/905695/


All Articles