parcelable

Migrate to the new kotlin-parcelize

谁都会走 提交于 2021-01-20 16:31:29
问题 Can anyone please explain how to migrate to the new kotlin-parcelize ? I tried: Replace apply plugin: 'kotlin-android-extensions' with apply plugin: 'kotlin-parcelize' in app build.gradle Replace import kotlinx.android.parcel.Parcelize with import kotlinx.parcelize.Parcelize The latter one leads to Class 'ParcelZonedDateTime' is not abstract and does not implement abstract member public abstract fun describeContents(): Int defined in android.os.Parcelable on e.g. this code: import androidx

Migrate to the new kotlin-parcelize

一个人想着一个人 提交于 2021-01-20 16:25:04
问题 Can anyone please explain how to migrate to the new kotlin-parcelize ? I tried: Replace apply plugin: 'kotlin-android-extensions' with apply plugin: 'kotlin-parcelize' in app build.gradle Replace import kotlinx.android.parcel.Parcelize with import kotlinx.parcelize.Parcelize The latter one leads to Class 'ParcelZonedDateTime' is not abstract and does not implement abstract member public abstract fun describeContents(): Int defined in android.os.Parcelable on e.g. this code: import androidx

How do I send OpenCV Mat as a putExtra to Android Intent?

亡梦爱人 提交于 2020-12-26 08:12:35
问题 I am trying to send either CvCameraViewFrame or Mat to another activity, but they don't implement Serializable or Parcelable and creating a wrapper class for them just to use it once seems like an overkill. How do I proceed? 回答1: I would have used fragments instead of activities and get/set common Mat present in container Activity from fragments. If there is a need to stick with multiple activities, assuming it's within process, options are Sharing - Use global Application subclass to get/set

How do I send OpenCV Mat as a putExtra to Android Intent?

陌路散爱 提交于 2020-12-26 08:12:24
问题 I am trying to send either CvCameraViewFrame or Mat to another activity, but they don't implement Serializable or Parcelable and creating a wrapper class for them just to use it once seems like an overkill. How do I proceed? 回答1: I would have used fragments instead of activities and get/set common Mat present in container Activity from fragments. If there is a need to stick with multiple activities, assuming it's within process, options are Sharing - Use global Application subclass to get/set

How to pass ParcelableArrayList from Fragment to Fragment?

大城市里の小女人 提交于 2020-12-15 05:30:50
问题 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 Activity that holds the Fragments in a FrameLayout: package com.blumonpay.restaurant.customer.presentation.activities; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.os.Bundle; import android

How to pass ParcelableArrayList from Fragment to Fragment?

瘦欲@ 提交于 2020-12-15 05:30:45
问题 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 Activity that holds the Fragments in a FrameLayout: package com.blumonpay.restaurant.customer.presentation.activities; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.os.Bundle; import android

How to ignore fields when using @Parcelize annotation in Kotlin

懵懂的女人 提交于 2020-12-11 05:14:08
问题 I want to ignore a field when using the @Parcelize annotation in Kotlin so that the field is not parceled, since this field does not implement the Parcelable interface. Starting with this, we get an error because PagedList is not parcelable: @Parcelize data class LeaderboardState( val progressShown: Boolean = true, val pagedList: PagedList<QUser>? = null ) : Parcelable Gives: Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be

How to ignore fields when using @Parcelize annotation in Kotlin

ぐ巨炮叔叔 提交于 2020-12-11 05:06:31
问题 I want to ignore a field when using the @Parcelize annotation in Kotlin so that the field is not parceled, since this field does not implement the Parcelable interface. Starting with this, we get an error because PagedList is not parcelable: @Parcelize data class LeaderboardState( val progressShown: Boolean = true, val pagedList: PagedList<QUser>? = null ) : Parcelable Gives: Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be

How do I pass ArrayList<Object> from one Activity to another Activity

我与影子孤独终老i 提交于 2020-07-10 10:27:28
问题 I want to pass ArrayList of an Object from one Activity to Activity. Here is the sample Code: { ArrayList<object> list=new ArrayList<>(); Object value[]=new Object[m.size()]; int n=0; value[]=new Object[n]; value[n]=data.getName("name"); value[n]=data.getLocation("location"); list.add(value[n]); n++; //Since there are "n" number of object } //here the value a which is ArrayList Object // which I want to pass it from here to another activity. So now how will I pass the object from here to

Parcelable, what is newArray for?

拟墨画扇 提交于 2020-06-24 11:51:06
问题 I am implementing Parcelable in order to transmit some simple data throughout an Intent. However, There is one method in the Parcelable interface that I don't understand at all : newArray() . It does not have any relevant documentation & is not even called in my code when I parcel/deparcel my object. Sample Parcelable implementation : public class MyParcelable implements Parcelable { private int mData; public int describeContents() { return 0; } public void writeToParcel(Parcel out, int flags