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
1
vote
3 answers

Null pointer error when passing Parcelable data

I am trying to pass an Order Object between two activities. This object contains an ArrayList of MenuItems. The class for Order is below: (it implements the parcelable interface). public class Order extends ArrayList implements Parcelable…
1
vote
1 answer

Null Pointer Exception When Retrieving Custom Parcelables

So I have been looking through StackOverFlow and can't seem to find a topic that completely resolves my problem. Many people have had problems with Null Pointer Exceptions while trying to use custom parcelables. I've seen problems resolved with…
1
vote
1 answer

Parcelable's variables have always the value 0.0 after Parcel

After I Parcel my Parcelable Object and want to return it back, the values of the variables are all 0.0! Any Idea why? Here is my Parcelable Class: public class ParcelData implements Parcelable { public byte mapIsSelected; public byte…
klanm
  • 3,168
  • 3
  • 19
  • 22
1
vote
1 answer

Parcelable object coming out with null fields

I am using a parcelable object to pass through an intent. The passing side uses this code: Parcelable product = new Product(res.getData(), alcohol.toLowerCase(Locale.ENGLISH).trim(), selectedSize, location); Intent intent = new…
Troy Cosentino
  • 4,658
  • 9
  • 37
  • 59
1
vote
2 answers

Passing arrayadapter and arraylist between fragments

I have an activity that contains two fragments. I would like to pass data (an ArrayAdapter and an ArrayList) between the two fragments. User operations in Fragment 1 modifies both datatypes, which then need to be passed onto Fragment 2. Similarly,…
user1124702
  • 1,015
  • 4
  • 12
  • 22
1
vote
1 answer

Android Parcelable create array

In background i parse JSON, and then in this background i send Json to parcelable And in Parcelable i writestring with JSONObject.optString how i can write ArrayList? List result = new ArrayList(array.length()); for (int i…
Ozik Abdullaev
  • 1,026
  • 1
  • 9
  • 26
1
vote
2 answers

Passing ArrayList between activities

I have an activity where I am adding objects into an ArrayList which implements the Parcelable interface. I then pass this list to another activity via a bundle however I get the following error when I try to print the size of the list in the new…
Javacadabra
  • 5,578
  • 15
  • 84
  • 152
1
vote
1 answer

Is there any way to pass a DOM Object via an Intent and Parcelable?

Is there any way to pass a JAXP Node or Document via an Intent and Parcelable? JAXP doesn't implement Parcelable, so the answer is probably --no. Is there any DOM library that implements Parcelable? Can someone provide a working example of…
yetimoner
  • 787
  • 2
  • 9
  • 19
1
vote
1 answer

How to Read and Write SoundPool object into Parcel?

Beginner here. I have a class with a SoundPool object in it. I would like to have the class implement Parcelable so that its instance can be passed between activities (so that I only load the sounds once). But I am facing a problem in writing the…
1
vote
1 answer

Passing ArrayList through broadcast intent

I followed the example at Help with passing ArrayList and parcelable Activity but for my case i'm trying to broadcast an intent from my Service class (Inside Asynctask) to Activity class like this. ArrayList addyExtras = new ArrayList…
dythe
  • 840
  • 5
  • 21
  • 45
1
vote
1 answer

Reading String from parcelable object returns null

I have a class that implements Parcelable. The class has 1 int and 2 String's. When reading only the int data is returned. The first string is returned as " " and second is returned as null. Writing parcel - After writing int - data position 376…
Salil
  • 496
  • 1
  • 5
  • 15
1
vote
0 answers

How to know the datatype of the remaining data on a Parcelable?

I am implementing a sort of mapping between a XSD object into a Parcelable on Android. Everything goes fine except when I have a more complex xsd element which contains a elements which are optional (minOccurs='0' maxOccurs='1'). I need to write my…
Thomas
  • 2,751
  • 5
  • 31
  • 52
1
vote
3 answers

Android Parcelable Cannot instantiate the type

I am working on an Android App, and I am trying to pass information using Parcelable. So here's what I've got. import android.os.Parcel; import android.os.Parcelable; abstract class Role implements Parcelable { private String name; private…
brancz
  • 451
  • 5
  • 15
1
vote
1 answer

Android: Pass HashMap to another Activity -> create a Parceable object?

I have a HashMap which I would pass to another Activity class. I simply use this code: HashMap mKeyValues = new HashMap(); // add some data to hash map Intent intent = new Intent(MainActivity.this,…
sk2212
  • 1,688
  • 4
  • 23
  • 43
1
vote
4 answers

Android ArrayList passing between activities

I have simple class Track, which stores information about route: import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import android.location.Location; public class Track implements Serializable { private static…
Kamil Lelonek
  • 14,592
  • 14
  • 66
  • 90