parcelable

Passing Parceleable Object to Fragment Type Mismatch

只愿长相守 提交于 2019-12-14 03:06:35
问题 I'm new to kotlin and trying to pass an object from my adapter to a fragment. But I am getting a type mismatch in the companion object for booklist . It says Required: Parceleable Found: List<ResourcesList>? I've also tried using putParcelableArrayList and putParcelableArray and Serializable but also with the same type mismatch. My data model looks like this: @Parcelize class ResourcesList (val id: Int, val name: String, val content: Contents, val tags: List<Tags>) : Parcelable @Parcelize

Why is my Parcelable Creator not working?

扶醉桌前 提交于 2019-12-13 23:55:35
问题 I failed to make my Class Parcelable and I don't know why public class Set : Java.Lang.Object, IParcelable { public string[] jugador { get; set; } = new string[2]; public bool[] jugado { get; set; } = new bool[1] { false }; public int[] games { get; set; } = new int[2] { 0, 0 }; public int[] noforzados { get; set; } = new int[2] { 0, 0 }; public int[] aces { get; set; } = new int[2] { 0, 0 }; public int[] winners { get; set; } = new int[2] { 0, 0 }; public int[] doblefaltas { get; set; } =

Do I need to 'keep' Parcelable in proguard rules while obfuscating

南楼画角 提交于 2019-12-13 14:42:04
问题 My Project has few classes that extends Parcelable. Do I need to 'keep' them in proguard rules while obfuscating. What is the general practice for parcelables? 回答1: No, the default android rules include this: -keepclassmembers class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator CREATOR; } These default rules will be applied if you leave the default generated gradle definition in place: proguardFiles getDefaultProguardFile('proguard-android.txt'),

RuntimeException: Parcel android.os.Parcel: Unmarshalling unknown type code when using android bundle

蓝咒 提交于 2019-12-13 14:22:14
问题 I am getting the below error message: java.lang.RuntimeException: Parcel android.os.Parcel@41141190: Unmarshalling unknown type code 7602286 at offset 16 at android.os.Parcel.readValue(Parcel.java:1921) at android.os.Parcel.readMapInternal(Parcel.java:2094) at android.os.Bundle.unparcel(Bundle.java:223) at android.os.Bundle.getFloat(Bundle.java:981) I am sending an object as a message using WiFi direct. Hence I am converting the object into byte array while sending and reversing the

Write Parcelable for ArrayList<String []> in android?

荒凉一梦 提交于 2019-12-13 07:03:42
问题 I just created model with String array and array list of string array.Like this public class LookUpModel implements Parcelable { private String [] lookup_header; private ArrayList<String []> loookup_values; public void writeToParcel(Parcel dest, int flags) { dest.writeStringArray(getLookup_header()); }; } I have implemented parcelbale then write for String [] but how to do for the ArrayList<String []> and that values need to pass to another activity.Thanks in advance. 回答1: Use dest

getParcelableExtra() crushing after Starting activity when passing an object

家住魔仙堡 提交于 2019-12-13 04:29:39
问题 Im trying to pass an object between activities but my app crushes: This is my class (the object im passing through the intent): public class item implements Parcelable { private int id; private String title; private String desc; private double lat; private double lon; private String pub; private int p; private int n; public item(int id, String title, String desc, double lat, double lon, String pub, int p, int n) { super(); this.id = id; this.title = title; this.desc = desc; this.lat = lat;

send List of objects with service using Parcelable [duplicate]

戏子无情 提交于 2019-12-13 04:08:12
问题 This question already has answers here : How to pass a parcelable object that contains a list of objects? (9 answers) Closed 5 years ago . First of all i need to retrieve the list of objects from FileUtils class. There i have the readFromAssets(Contex contex) method which returns the list. So i'm creating object from FileUtils and i'm getting the list. After that i have tried to implement Parcelable so i can send the list( i dont know if my implementation is OK ). And at the end to send the

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

我怕爱的太早我们不能终老 提交于 2019-12-13 02:36:50
问题 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 that? Serialization isn't an option; nasty performance hit. Storing the data in res/xml is not an option: it must eventually (by end of project) be encrypted on disk. Android's "compiled" XML Access Tools do not support decrypting the whole XML. Of course I

Android communication between applications using ResultReceiver

拟墨画扇 提交于 2019-12-13 01:56:59
问题 I have two applications. First application is simple service application which do some work in background and finish. I decided to use IntentService . @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } ResultReceiver callbacks = intent.getExtras().getParcelable(EXTRA_CALLBACKS); ... The second application must consume the IntentService from the first using Intent in my case. public class SendActivity extends AppCompatActivity { private ResultReceiver

StackOverflowError while writing Parcelable

耗尽温柔 提交于 2019-12-13 01:27:52
问题 I have two classes, let's assume they look like these: Movie.java public class Movie implements Parcelable { private int year; private List<Actor> actors; // Constructor, getters and setters, Parcelable implementation } Actor.java public class Actor implements Parcelable { private String name; private Movie movie; // Constructor, getters and setters, Parcelable implementation } And now when I'm trying to write Movie into parcelable I get StackOverflowError: java.lang.StackOverflowError at