I've a okhttp3.MultipartBody.Part in an activity and need to send that to next activity through Intent put extra.
It gives me an error
Parcel: unable to marshal value okhttp3.MultipartBody$Part
As a work around, I've added a static variable in util file and accessing it in next activity.
Is there a possibility to send it in intent?
Is it stopping because it's a huge data?
Is there a possibility to send it in intent?
No, sorry.
Is it stopping because it's a huge data?
No. It is stopping because it is the wrong data type. Intent
extras cannot hold arbitrary objects.
It is also possible that it would crash your app due to size, depending on what is in it, but you are not even getting that far.
As a work around, I've added a static variable in util file and accessing it in next activity.
In modern Android apps, ideally neither activity would have any OkHttp objects. Have a repository handle your communications with the server, and the activities (or, better yet, viewmodels for those activities) can talk to the repository. See https://developer.android.com/jetpack/docs/guide for more.