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
1 answer

android - onSaveInstanceState callback how to save a SpannableString

I have a string thats HTML formatted and saved as a SpannableString. On a config change etc onSaveInstanceState is called prior and then onRestoreInstanceState to restore states etc. How can i save and restore a spannableString ... all i see is…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
1
vote
2 answers

Parcelable error sending object from one to another activity

I cant resolve problem when i sending my object "filmovi" to another activity i got a error. when i was tried to send another object "korisnik" it works without any problem. Error FATAL EXCEPTION: main java.lang.ClassCastException:…
Srđan Marković
  • 125
  • 1
  • 2
  • 8
1
vote
1 answer

Android Parcelable readStringArray bad array lengths

Can you tell me how to solve this? It throws a bad array length exception and after debugging, I found this method throws the Exception: --------------------------My Code----------------------------------- public class SingleModels implements…
Single
  • 31
  • 1
  • 5
1
vote
1 answer

Sending data to a Fragment instead of an Activity with a Parcelable object

I want to send data to a Fragment with a Parcelable class I've made. I know this is how you'd go about things when using an Activity (ObjectA being the class that extends Parcelable): ObjectA obj = new ObjectA(); // Set values etc. Intent i =…
1
vote
2 answers

Whats wrong with this Parcelable object passing?

I have successfully passed arraylist of objects by using parcelable. But when i am trying to pass a object from one activity to another its not working. In first Activity (ShowActivity), i have a gridView and for onclick i want to send a object to…
shaon007
  • 163
  • 3
  • 16
1
vote
3 answers

How to use Parcelable for a class which has multiple constructors?

Well, i was trying to pass arraylist of objects from one activity to another. I have 2 constructors in the class Student. If, i use, Serializable than the code is like below: @SuppressWarnings("serial") public class Student implements…
shaon007
  • 163
  • 3
  • 16
1
vote
0 answers

Android Parcelable Object giving ClassNotFoundException when unmarshalling

I have wrote two Parcelable class, i.e. ScheduleItem and Venue. ScheduleItem.java public class ScheduleItem implements Parcelable { private static final SimpleDateFormat FORMATTER = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss Z"); …
1
vote
2 answers

creating a Parcelable which will be used inside the same activity

I've imported some JSON data and fetched it into a custom arrayList. The arraylist looks like this: ArrayList> postList; It all works fine, but if the orientation changes the whole JSON parse/fetch process will start over…
Foo
  • 596
  • 2
  • 5
  • 21
1
vote
3 answers

Android, Serializable/Parcelable problem in client-server app

I want to send complex data from my android to a remote server via TCP-sockets. I know that I need to serialize the Objects. In Android this is done via parcelable. But this is an android specific interface and the server only knows the serializable…
user283494
  • 1,897
  • 4
  • 19
  • 26
1
vote
1 answer

android Activity Recognition Parcelable protocol requires a Parcelable.Creator

I am having problems with Activity Recognition and I get the following error: 05-07 22:32:03.553: E/AndroidRuntime(5546): FATAL EXCEPTION: IntentService[dk.finne.minrute.service.ActivityRecognitionIntentService] 05-07 22:32:03.553:…
1
vote
0 answers

Why does getArguments().getParcelable(key) behave differently in local test device vs production release?

In my MainActivity I call this code to change to a new fragment, I pass a bundle with parcelable object, itemModel to the fragment: Bundle bundle = new Bundle(); bundle.putParcelable(ItemModel.ParcelableKey, itemModel); fragment = new…
I'm a frog dragon
  • 7,865
  • 7
  • 46
  • 49
1
vote
3 answers

ClassCastException when trying to use ParcelableArrayList on custom object array

I’m trying to implement Parcelable instead of Serializable as it’s supposed to be more efficient. From my MainActivity I want to pass the object of generic type ArrayList to the same activity, so that I get it on orientation…
sjain
  • 23,126
  • 28
  • 107
  • 185
1
vote
3 answers

Android - Alternative to Using Context Inside of Parcelable

I have a class I use for managing bitmaps in my application. It needs to have a context passed to it to be able to use getResources(). Problem is I believe you can't use Context inside of a Parcelable class. Anyone have any ideas for a…
odds0cks
  • 141
  • 4
  • 11
1
vote
1 answer

Are there alternatives of Serialization in Android?

I've came to Android from Java. I used there, with successes, Serialization mechanizm to keep data in file (mainly to avoid of using additional software like MySQL DB). Mark-up of input-output operations of serialization was easily acceptable on PC…
rainbow
  • 1,161
  • 3
  • 14
  • 29
1
vote
0 answers

"Not a whole File" Exception when trying to get ParcelFileDescriptor from Uri

I have an activity that can receive intents with ACTION_VIEW, and "application/octet-stream" mime types. when I receive a file from "Google Drive" android app, Uri is in Intent Extra's getParcelableExtra() and every thing works fine. Uri returnUri =…
user2136334
  • 648
  • 7
  • 16