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

Parcelable custom handler, message never received

I want to parcelable a Handler object to send it by a Bundle from one Activity to a service in order to get some info from this service. Right now, to test it it's a simple message. Here's the code in the Activity: private MyHandler mHandlerSharing…
Fernando
  • 751
  • 2
  • 13
  • 27
0
votes
2 answers

Android: passing data from one fragment To another

I wanted to pass arraylist of objects from one fragment to another i tried the following ways, wanted to know what are the pro's and con's of the following or is their any better approach First public myFragment(ArrayList myarray) { super(); …
0
votes
2 answers

Creating a Parcelable ArrayList to handle orientation changes results in null

I'm trying to handle orientation changes in my activity. I have a ListView that gets populated by a custom adapter. The adapter accepts an ArrayList where Listing is custom object I have created. I know the ListView works but on an…
mez.pahlan
  • 1,053
  • 2
  • 11
  • 25
0
votes
0 answers

How make an object Parcelable that holds a 2 -dimensional array of a custom object?

I have a class A with and inner class B. like the code bellow. I dont know where I am going wrong. What would be the proper way to make Class A Parcelable? Here is how i have right now and its no good. Thanks! public class A implements Parcelable { …
0
votes
0 answers

Android: pass a BroadcastReceiver via an Intent

I have an instance of object A that has a accumulator and a BroadcastReceiver that will increment the accumulator. I have an IntentService that receives the object A as a parcel in the intent, sends the value via the SmsManager and when the "sent"…
DennisVDB
  • 1,347
  • 1
  • 14
  • 30
0
votes
1 answer

Parcelable vs Serializable - for classes without any fields

Often I have to pass to fragment (or to activity) some interface instance without any internal data. To pass it to fragment (or activity), I should write it to Bundle (or Intent) as Parcelable or Serializable. What do I choose from these two options…
Leonid Semyonov
  • 387
  • 3
  • 9
0
votes
1 answer

how to use Parcelable for custom type objects/variable in a class (Android)

I have make a class which has a custom class object/variable and i want to make this class parcelable for passing it in to the intend so that i receive the reponse in next activity MORE DETAILED I Have class first ie public class Data implements…
yash
  • 387
  • 1
  • 5
  • 20
0
votes
1 answer

How to create Parcelable code for object that contains GregorianCalendar

I haven't understood how to create the code needed to implement correctly the Parcelable for an object that contains GregorianCalendar objects. E.g. for an object User that contains String name; and GregorianCalendar creationDate;, my attempt is…
AndreaF
  • 11,975
  • 27
  • 102
  • 168
0
votes
2 answers

How can I parse Parcel object in host instead of android device?

I want to communicate with an APP in android device using socket. We will send and receive many parcel objects. App will get some system information and it will be easier using parcel. So I have to do more things to parse parcel object... I can use…
efei
  • 281
  • 1
  • 3
  • 14
0
votes
1 answer

java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList in Parcelable object

I have written the following classes: public class Company implements Parcelable { private int uid; @SerializedName("field_user_org_name_value") private String name; @SerializedName("field_user_org_address_value") private String…
Kostya Khuta
  • 1,846
  • 6
  • 26
  • 48
0
votes
1 answer

passing parcelable class from fragment to another activity

I usually have no problem with parcelable, but this time i got NPE...and i cant fix it. Please kindly help me. The NPE occurred only when i try to pass the parcelable class from fragment to another activity. Things working fine if i pass the…
Blaze Tama
  • 10,828
  • 13
  • 69
  • 129
0
votes
2 answers

onSaveInstanceState() not called on custom view when app is moved to background

In an app I am developing, I have a custom view in which I need to save the instance state when either the screen configuration changes or the app is moved to the background. I implement onSaveInstanceState() and onRestoreInstanceState(Parcelable…
Zero
  • 1,864
  • 3
  • 21
  • 39
0
votes
1 answer

BadParcelable Exception occasionally causing app to crash

I am getting the error android.os.BadParcelableException: Parcelable protocol requires a Parcelable.Creator object called CREATOR but it only happens occasionaly and randomly. I have no idea why sometime it cause the app to crash and other times it…
Cam Connor
  • 1,231
  • 2
  • 25
  • 40
0
votes
2 answers

NullPointerException : Get Parcelable data from intent

I have a service that handles notifications. When I click on the notification I'm sending a Parcelable object to an Activity (NotificationActivity) : Service : Intent destIntent = new Intent (this, NotificationActivity.class); destIntent.putExtra…
user1079425
0
votes
1 answer

No data on Parcelable object sent to other activities with other parcelables inside

I'm doing an app that needs to pass an object through activities, so to achieve this I've made 3 parcelable classes. The structure is the following: > List of Quiz: > - int event_id; > - String name; > - String business_unit; > - int…
Víctor Martín
  • 3,352
  • 7
  • 48
  • 94