You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@raphaelbussa When the Activity is recycled HeaderView will get an error.
java.lang.ClassCastException: java.lang.String cannot be cast to android.net.Uri
at rebus.header.view.Profile.<init>(Profile.java:82)
at rebus.header.view.Profile.<init>(Profile.java:46)
at rebus.header.view.Profile$1.createFromParcel(Profile.java:51)
at rebus.header.view.Profile$1.createFromParcel(Profile.java:48)
at android.os.Parcel.readParcelable(Parcel.java:2774)
at android.os.Parcel.readValue(Parcel.java:2668)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:3118)
at android.os.Parcel.readSparseArray(Parcel.java:2351)
at android.os.Parcel.readValue(Parcel.java:2725)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3037)
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:288)
at android.os.BaseBundle.unparcel(BaseBundle.java:232)
at android.os.Bundle.getParcelable(Bundle.java:940)
at rebus.header.view.HeaderView.onRestoreInstanceState(HeaderView.java:793)
at android.view.View.dispatchRestoreInstanceState(View.java:18608)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3821)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.View.restoreHierarchyState(View.java:18586)
at com.google.android.material.internal.NavigationMenuPresenter.onRestoreInstanceState(NavigationMenuPresenter.java:192)
at androidx.appcompat.view.menu.MenuBuilder.dispatchRestoreInstanceState(MenuBuilder.java:363)
at androidx.appcompat.view.menu.MenuBuilder.restorePresenterStates(MenuBuilder.java:375)
at com.google.android.material.navigation.NavigationView.onRestoreInstanceState(NavigationView.java:216)
at android.view.View.dispatchRestoreInstanceState(View.java:18608)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3821)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.View.restoreHierarchyState(View.java:18586)
at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2135)
at android.app.Activity.onRestoreInstanceState(Activity.java:1135)
at android.app.Activity.performRestoreInstanceState(Activity.java:1090)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1317)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2991)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Turn this option on under the developer option to test.
The text was updated successfully, but these errors were encountered:
Turning Profile into Kotlin will solve this issue.
@Parcelize
data class Profile(
val id: Int,
val avatarUri: String?,
val avatarRes: Int,
val backgroundUri: String?,
val backgroundRes: Int,
val username: String?,
val email: String?
) : Parcelable {
private constructor(builder: Builder) : this(
builder.id,
builder.avatarUri,
builder.avatarRes,
builder.backgroundUri,
builder.backgroundRes,
builder.username,
builder.email
)
companion object {
inline fun build(block: Builder.() -> Unit) = Builder().apply(block).build()
}
class Builder {
var id: Int = 0
var avatarUri: String? = null
var avatarRes: Int = 0
var backgroundUri: String? = null
var backgroundRes: Int = 0
var username: String? = null
var email: String? = null
fun build() = Profile(this)
}
}
@raphaelbussa When the Activity is recycled HeaderView will get an error.
Turn this option on under the developer option to test.
![image](https://user-images.githubusercontent.com/10644057/67644129-904ece00-f959-11e9-804a-0c707786d99b.png)
The text was updated successfully, but these errors were encountered: