1
I created a Splash Screen that works normally, but when opening the application instead of directly entering Splash, it runs a white screen.
Splash.xml
<?xml version="1.0" encoding="utf-8"?>
<ImageView
android:id="@+id/splash"
android:layout_width="154dp"
android:layout_height="217dp"
android:background="@drawable/logo" />
Class
package empresa.example.easyfood;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
public class SplashActivity extends AppCompatActivity {
//Timer da splash screen
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
/*
* Exibindo splash com um timer.
*/
@Override
public void run() {
// Esse método será executado sempre que o timer acabar
// E inicia a activity principal
Intent i = new Intent(SplashActivity.this, CadastroLogin.class);
startActivity(i);
// Fecha esta activity
finish();
}
}, SPLASH_TIME_OUT);
}
}
How do I take white screen?