Questions tagged [parcelable]

parcelable refers to the capability of an object to be converted to a parcel, a container for reading and writing data of various type, using type specific rather than generic serialization

parcelable is defined in the Android API as as interface for classes whose instances can be written to and restored from a parcel

References

1664 questions
0
votes
1 answer

how to create an object of CellInfo for unit testing?

I am writing unit test case, What I can't understand is how can I make a dummy object of CellinfoGsm or of any technology and test my code from it. I did read the documentation and the base class of CellInfo but I can't understand how to use the…
0
votes
1 answer

Sometimes an error occurs when creating a fragment with parceble

I am creating a framgent using Parcelable. In most cases there is nothing wrong, but in the firebase Crashlytics report I get an Unmarshalling unknown type code Exception. I am not sure why I am getting that error. Below is my code. dataClass class…
0
votes
1 answer

Is this the right way to pass a Period class through a Parcelable

I have a class that implements a Parcelable, but it had only primitive types as members. Until now, I passed an instance of this class as a Parcelable without problem between two activities. But I'm adding a member which type is a Period…
tdmsoares
  • 533
  • 7
  • 24
0
votes
1 answer

Problem with Parcel // ArrayList

I am currently trying to pass an ArrayList of objects from one activity to another. After much searching, I saw that you could pass things as parcels. Here is what I ended up doing: public class PartsList extends ArrayList implements…
Cody
  • 8,686
  • 18
  • 71
  • 126
0
votes
2 answers

How do I pass ArrayList from one Activity to another Activity
I want to pass ArrayList of an Object from one Activity to Activity. Here is the sample Code: { ArrayList list=new ArrayList<>(); Object value[]=new Object[m.size()]; int n=0; value[]=new Object[n]; …
Athos Tokbi
  • 195
  • 1
  • 17
0
votes
3 answers

Problem with Constructor in Parcelable in both Abstract and Derived Classes

I have an abstract class and its children, and I wanted to pass the children through one activity to another through intent.putExtra(String, Parcelable); The activity receiving the Intent would accept any parcelable since it's an object extending…
tdmsoares
  • 533
  • 7
  • 24
0
votes
1 answer

How does overriding of readObject() and writeObject() methods under the serializable interface, find its application in real life development?

So, I was studying serialization and I got to know about us having the ability to override the above stated methods.I was wondering,how could I use it? One idea that came to my mind is maybe encrypting and decrypting the data while writing and…
kars
  • 3
  • 2
0
votes
2 answers

How to pass an interface using intent

This is my Interface class interface InstallerInterface { fun onInstallation(context: Context) } I implements the interface in this class class FirstActivity : InstallerInterface{ override fun onInstallation(context: Context) { …
0
votes
1 answer

Problem to read an ArrayList or List of a parcelable class

I have this parcelable class: public class EventInviteWorkingHours implements Parcelable { int dayOfWeek; String begin; String finish; public EventInviteWorkingHours() { } protected EventInviteWorkingHours(Parcel in) { …
0
votes
1 answer

I got " Error Unable to invoke no-args constructor for class CLASSNAME" with Parcalize

I am using @Parcelize to create parcable model with kotlin @Parcelize data class GymPackage( val id: Int?, val name: String?, val description: String?, val price: Int?, val duration: Int?, …
Mahmoud Mabrok
  • 1,362
  • 16
  • 24
0
votes
0 answers

Parcelable.CREATOR on abstract class

I'm trying to pass an ArrayList of unknown class type that extend an abstract class, to another activity using Parcelable. Since its not possible to use Parcelable.CREATOR on the abstract class, there is an error when I try to create the ArrayList:…
A.C
  • 423
  • 2
  • 4
  • 13
0
votes
2 answers

How to pass ParcelableArrayList from Fragment to Fragment?

I have been trying to find the way to pass a ParcelableArrayList from one Fragment to Another and for some reason when I receive the ParcelableArrayList it's empty. I have checked many posts about this problem but I don't make it work. This is my…
0
votes
1 answer

Convert parcelable Kotlin class with parent class to JSON

In my Android Kotlin project, I have an abstract class and a child class that inherits the abstract class: abstract class AbstractExample( val test2: String, val test3: String) : Parcelable @Parcelize class Example( val test1: String, …
matteoh
  • 2,810
  • 2
  • 29
  • 54
0
votes
1 answer

@Parcelize and Superclass, doubling data because of constructor requirement

I have a Result parcelable class that is supposed to serve as a container for a key and a parcelable data. This is how I define it: @Parcelize open class Result(val key: String, val data: T?) : Parcelable The problem is that…
0
votes
1 answer

Passing a reference to a Raw video file through Intent and using it in another activity

In my current working code, I pass the reference of an image from a screen that shows some thumbnails. When the thumbnail is selected, the image id is stored and then used in a new activity. Now, when a thumbnail is selected, I want to store the…
jbellomy
  • 49
  • 1
  • 8