How to parcelize Google's Place class? The Next CEO of Stack OverflowAndroid: Difference between Parcelable and Serializable?Parcelable where/when is describeContents() used?How to read/write a boolean when implementing the Parcelable interface?How can I make my custom objects Parcelable?Parcelable and InheritanceActivity receives Null from Parcelable objectAndroid Parcelable in Kotlin: CREATOR not found on Parcelable data classKotlin - Property initialization using “by lazy” vs. “lateinit”How to implement parcelable with my custom class containing Hashmap and SparseArray?Android : Parcelable : Class not found when unmarshalling
Is it ever safe to open a suspicious HTML file (e.g. email attachment)?
Why am I getting "Static method cannot be referenced from a non static context: String String.valueOf(Object)"?
Why is information "lost" when it got into a black hole?
What day is it again?
IC has pull-down resistors on SMBus lines?
How to avoid supervisors with prejudiced views?
What flight has the highest ratio of timezone difference to flight time?
Is French Guiana a (hard) EU border?
Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?
Is there such a thing as a proper verb, like a proper noun?
how one can write a nice vector parser, something that does pgfvecparseA=B-C; D=E x F;
Is dried pee considered dirt?
"Eavesdropping" vs "Listen in on"
In the "Harry Potter and the Order of the Phoenix" video game, what potion is used to sabotage Umbridge's speakers?
What is the process for purifying your home if you believe it may have been previously used for pagan worship?
Does the Idaho Potato Commission associate potato skins with healthy eating?
Inductor and Capacitor in Parallel
What's the commands of Cisco query bgp neighbor table, bgp table and router table?
Free fall ellipse or parabola?
What does "shotgun unity" refer to here in this sentence?
Aggressive Under-Indexing and no data for missing index
Does Germany produce more waste than the US?
Can I board the first leg of the flight without having final country's visa?
What CSS properties can the br tag have?
How to parcelize Google's Place class?
The Next CEO of Stack OverflowAndroid: Difference between Parcelable and Serializable?Parcelable where/when is describeContents() used?How to read/write a boolean when implementing the Parcelable interface?How can I make my custom objects Parcelable?Parcelable and InheritanceActivity receives Null from Parcelable objectAndroid Parcelable in Kotlin: CREATOR not found on Parcelable data classKotlin - Property initialization using “by lazy” vs. “lateinit”How to implement parcelable with my custom class containing Hashmap and SparseArray?Android : Parcelable : Class not found when unmarshalling
in my custom object, i have 7 attributes, 5 of them are strings, and were auto genereated in the contructor fine, but the other two did not generate automatically. the last two are of class Place
and ArrayList<int>
:
class Spot() : Parcelable{
private var uid: String? = null
private var timeFrom: String? = null
private var timeTo: String? = null
private var rate: String? = null
private var description: String? = null
private var place: Place? = null
private var days : ArrayList<Int>? = null
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
...
How do i parcelize them?
arraylist kotlin google-places-api parcelable parcel
add a comment |
in my custom object, i have 7 attributes, 5 of them are strings, and were auto genereated in the contructor fine, but the other two did not generate automatically. the last two are of class Place
and ArrayList<int>
:
class Spot() : Parcelable{
private var uid: String? = null
private var timeFrom: String? = null
private var timeTo: String? = null
private var rate: String? = null
private var description: String? = null
private var place: Place? = null
private var days : ArrayList<Int>? = null
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
...
How do i parcelize them?
arraylist kotlin google-places-api parcelable parcel
add a comment |
in my custom object, i have 7 attributes, 5 of them are strings, and were auto genereated in the contructor fine, but the other two did not generate automatically. the last two are of class Place
and ArrayList<int>
:
class Spot() : Parcelable{
private var uid: String? = null
private var timeFrom: String? = null
private var timeTo: String? = null
private var rate: String? = null
private var description: String? = null
private var place: Place? = null
private var days : ArrayList<Int>? = null
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
...
How do i parcelize them?
arraylist kotlin google-places-api parcelable parcel
in my custom object, i have 7 attributes, 5 of them are strings, and were auto genereated in the contructor fine, but the other two did not generate automatically. the last two are of class Place
and ArrayList<int>
:
class Spot() : Parcelable{
private var uid: String? = null
private var timeFrom: String? = null
private var timeTo: String? = null
private var rate: String? = null
private var description: String? = null
private var place: Place? = null
private var days : ArrayList<Int>? = null
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
...
How do i parcelize them?
arraylist kotlin google-places-api parcelable parcel
arraylist kotlin google-places-api parcelable parcel
asked Mar 7 at 18:28
BarcodeBarcode
9811
9811
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There are several methods to do it. You need to add the code yourself for ArrayList and Place Object in the constructor
and writeToParcel methods.
constructor
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
// Add the below to line of code
days = parcel.readArrayList(Int::class.java.classLoader) as ArrayList<Int>?
place = parcel.readParcelable<Place>(Place::class.java.classLoader)
writeToParcel
override fun writeToParcel(parcel: Parcel, flags: Int)
parcel.writeString(uid)
parcel.writeString(timeFrom)
parcel.writeString(timeTo)
parcel.writeString(rate)
parcel.writeString(description)
// Add the below to line of code
parcel.writeList(days)
parcel.writeParcelable(place, flags)
And if I'm not wrong, Googles Place class is already Parcelable so this code should work.
Hope it helps!
.readParcelable<Place>
gives error:Type argument is not within its bounds, Expected Parcelable!, Found Place
– Barcode
Mar 8 at 17:09
which Place object are you using? It's saying the Place class is not Parcelable. I have used this Google Place Object.
– bhavya_karia
Mar 9 at 5:12
add a comment |
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050546%2fhow-to-parcelize-googles-place-class%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are several methods to do it. You need to add the code yourself for ArrayList and Place Object in the constructor
and writeToParcel methods.
constructor
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
// Add the below to line of code
days = parcel.readArrayList(Int::class.java.classLoader) as ArrayList<Int>?
place = parcel.readParcelable<Place>(Place::class.java.classLoader)
writeToParcel
override fun writeToParcel(parcel: Parcel, flags: Int)
parcel.writeString(uid)
parcel.writeString(timeFrom)
parcel.writeString(timeTo)
parcel.writeString(rate)
parcel.writeString(description)
// Add the below to line of code
parcel.writeList(days)
parcel.writeParcelable(place, flags)
And if I'm not wrong, Googles Place class is already Parcelable so this code should work.
Hope it helps!
.readParcelable<Place>
gives error:Type argument is not within its bounds, Expected Parcelable!, Found Place
– Barcode
Mar 8 at 17:09
which Place object are you using? It's saying the Place class is not Parcelable. I have used this Google Place Object.
– bhavya_karia
Mar 9 at 5:12
add a comment |
There are several methods to do it. You need to add the code yourself for ArrayList and Place Object in the constructor
and writeToParcel methods.
constructor
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
// Add the below to line of code
days = parcel.readArrayList(Int::class.java.classLoader) as ArrayList<Int>?
place = parcel.readParcelable<Place>(Place::class.java.classLoader)
writeToParcel
override fun writeToParcel(parcel: Parcel, flags: Int)
parcel.writeString(uid)
parcel.writeString(timeFrom)
parcel.writeString(timeTo)
parcel.writeString(rate)
parcel.writeString(description)
// Add the below to line of code
parcel.writeList(days)
parcel.writeParcelable(place, flags)
And if I'm not wrong, Googles Place class is already Parcelable so this code should work.
Hope it helps!
.readParcelable<Place>
gives error:Type argument is not within its bounds, Expected Parcelable!, Found Place
– Barcode
Mar 8 at 17:09
which Place object are you using? It's saying the Place class is not Parcelable. I have used this Google Place Object.
– bhavya_karia
Mar 9 at 5:12
add a comment |
There are several methods to do it. You need to add the code yourself for ArrayList and Place Object in the constructor
and writeToParcel methods.
constructor
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
// Add the below to line of code
days = parcel.readArrayList(Int::class.java.classLoader) as ArrayList<Int>?
place = parcel.readParcelable<Place>(Place::class.java.classLoader)
writeToParcel
override fun writeToParcel(parcel: Parcel, flags: Int)
parcel.writeString(uid)
parcel.writeString(timeFrom)
parcel.writeString(timeTo)
parcel.writeString(rate)
parcel.writeString(description)
// Add the below to line of code
parcel.writeList(days)
parcel.writeParcelable(place, flags)
And if I'm not wrong, Googles Place class is already Parcelable so this code should work.
Hope it helps!
There are several methods to do it. You need to add the code yourself for ArrayList and Place Object in the constructor
and writeToParcel methods.
constructor
constructor(parcel: Parcel) : this()
uid = parcel.readString()
timeFrom = parcel.readString()
timeTo = parcel.readString()
rate = parcel.readString()
description = parcel.readString()
// Add the below to line of code
days = parcel.readArrayList(Int::class.java.classLoader) as ArrayList<Int>?
place = parcel.readParcelable<Place>(Place::class.java.classLoader)
writeToParcel
override fun writeToParcel(parcel: Parcel, flags: Int)
parcel.writeString(uid)
parcel.writeString(timeFrom)
parcel.writeString(timeTo)
parcel.writeString(rate)
parcel.writeString(description)
// Add the below to line of code
parcel.writeList(days)
parcel.writeParcelable(place, flags)
And if I'm not wrong, Googles Place class is already Parcelable so this code should work.
Hope it helps!
edited Mar 8 at 7:56
answered Mar 8 at 7:21
bhavya_kariabhavya_karia
6817
6817
.readParcelable<Place>
gives error:Type argument is not within its bounds, Expected Parcelable!, Found Place
– Barcode
Mar 8 at 17:09
which Place object are you using? It's saying the Place class is not Parcelable. I have used this Google Place Object.
– bhavya_karia
Mar 9 at 5:12
add a comment |
.readParcelable<Place>
gives error:Type argument is not within its bounds, Expected Parcelable!, Found Place
– Barcode
Mar 8 at 17:09
which Place object are you using? It's saying the Place class is not Parcelable. I have used this Google Place Object.
– bhavya_karia
Mar 9 at 5:12
.readParcelable<Place>
gives error: Type argument is not within its bounds, Expected Parcelable!, Found Place
– Barcode
Mar 8 at 17:09
.readParcelable<Place>
gives error: Type argument is not within its bounds, Expected Parcelable!, Found Place
– Barcode
Mar 8 at 17:09
which Place object are you using? It's saying the Place class is not Parcelable. I have used this Google Place Object.
– bhavya_karia
Mar 9 at 5:12
which Place object are you using? It's saying the Place class is not Parcelable. I have used this Google Place Object.
– bhavya_karia
Mar 9 at 5:12
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050546%2fhow-to-parcelize-googles-place-class%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown