'how to unpack FIrebaseUser from parcelable
So I have a code that includes a User class that contains FirebaseUser. Now I am trying to pass the class through Intent but, although FirebaseUser has a method to write to the parcel, it doesn't have a static Creator so I can't find a method to unpack from the parcel.
here is the writeToParcel method of my class.
@Override
public void writeToParcel(Parcel dest, int flags) {
this.user.writeToParcel(dest, flags);
dest.writeInt(this.Role);
dest.writeString(this.Address);
dest.writeString(this.phoneNumber);
}
So after getting no answers in almost a month I chose to switch over to this constructor which is not the best way but it is enough.
protected User(Parcel in) {
this.user = FirebaseAuth.getInstance().getCurrentUser();
this.Role = in.readInt();
this.Address = in.readString();
this.phoneNumber = in.readString();
this.docRef = FirebaseFirestore.getInstance().document(in.readString());
}
But if someone finds an answer to my question it would be amazing.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
