Tentei fazer uma splash screen para o meu app mas nem ela e nem o prórpio app estão carregando mais.
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.teamlist"
tools:ignore="GoogleAppIndexingWarning">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name=".TeamListApplication"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup">
<activity android:name=".SplashScreenActivity" android:theme="@style/AppCompat.FullScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.activity.TeamListActivity"></activity>
<activity android:name=".ui.activity.DetailTeamActivity"></activity>
</application>
</manifest>
activity_splash_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/activity_splash_screen_image"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/splash_image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
SplashScreenActivity.java
public class SplashScreenActivity extends AppCompatActivity {
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
setContentView(R.layout.activity_splash_screen);
Handler handleSplashScreen = new Handler();
handleSplashScreen.postDelayed(new Runnable() {
@Override
public void run() {
initSplashActivity();
}
}, 2000);
}
private void initSplashActivity() {
Intent intent = new Intent(SplashScreenActivity.this, TeamListActivity.class);
startActivity(intent);
finish();
}
}
Quando inicializo o app ele fica com uma tela preta e não carrega mais nada e não apresenta nenhum tipo de erro. O que poderia fazer para solucionar esse problema?