I've been struggling for hours and ensure all measures are taken, it's launching an activity but showing a white screen, println on activity's onCreate show's no output either . Here's my checklist, please review.
1. AndroidManifest.xml
<activity android:name="ActivityB" />
2. ActivityA
println("this text is printed in the logs") // work
val intent = Intent(this, ActivityB::class.java).apply {
putExtras(Bundle().apply {
putSerializable("data", data)
})
}
startActivityForResult(intent, 2) // activity launches but white screen
3. ActivityB
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
setContentView(R.layout.activity_b) // not showing, white screen only
println("Hello World") // no effect
}
4. res/layout/activity_b.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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>