0

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);

    }
Jagjeet Singh
  • 204
  • 1
  • 2
  • 12

5 Answers5

1

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/

Rajesh Gopu
  • 863
  • 9
  • 33
0

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>

Prabhuraj
  • 928
  • 2
  • 8
  • 14
0

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.

Prashanth Debbadwar
  • 1,047
  • 18
  • 33
0

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.

chevalier
  • 51
  • 5
0

I had also same issue please find below the question as well as the resolution: White screen is displayed first time on gradle build.

Community
  • 1
  • 1
Gaurav Singh
  • 2,200
  • 16
  • 30