Reputation: 204
Here is my source code of launcher activity. I search a lot on stack overflow but nothing getting good answer
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_lang);
init();
}
private void init(){
spnLanguage = (Spinner)findViewById(R.id.spnLanguage);
btnNext = (Button)findViewById(R.id.btnNext);
btnNext.setOnClickListener(this);
}
Upvotes: 0
Views: 835
Reputation: 2320
I had also same issue please find below the question as well as the resolution: White screen is displayed first time on gradle build.
Upvotes: 0
Reputation: 51
I had a similar problem some time ago.
The activity is displayed to the user when it reaches the onStart()
method. Your init()
seems to take some time so until it finishes, you will only see the empty activity.
You could either trigger all heavy background work (that is not needed for the initial GUI setup) in a later method or first call another activity acting as splash screen if you have to keep all content of init()
where it is.
Upvotes: 0
Reputation: 1047
In my case delay was bit more. After searching a lot I found that it is because of android studio auto run feature. After disabling the auto run issue is solved.
Upvotes: 0
Reputation: 893
Android apps do take some amount of time to start up, especially on a cold start. There is a delay there that you may not be able to avoid
https://www.bignerdranch.com/blog/splash-screens-the-right-way/
Upvotes: 1
Reputation: 928
In the AndroidManifest file of your starting Activity, mention a transparent Theme
<activity
android:name="Your activity name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Upvotes: 0