3

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 conversion while receiving.

My object has two fields - one String and one android bundle. While sending I am populating the string field and putting a float value in the android bundle using a key.

I am able to retrieve the string value at the receiver's end. The error comes when I try to retrieve the float value present inside the bundle using getFloat method. What could be the reason for this?

A. Wali
  • 454
  • 3
  • 22
NewOne
  • 401
  • 5
  • 19
  • Did you manage to find a solution - I am having a similar issue too. Also, have you had a look at answers from [this question also on SO](http://stackoverflow.com/questions/19672772/parcel-unmarshalling-unknown-type-code)? – Farbod Salamat-Zadeh Jun 23 '16 at 16:54

1 Answers1

1

After spending lots of hour i found solution, that i made mistake in Parcelable class, i forgot to write and read one of the parameters, finally i solved issue, my code look like:

public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(filepath);
    dest.writeString(filename);
    dest.writeString(fileCount);
    dest.writeInt(index);
}

public YourParcelableClassName(Parcel in){
    filepath = in.readString();
    filename = in.readString();
    fileCount = in.readString();
    index = in.readInt();
}

in the first activity pass data,

Intent mIntent = new Intent(YourFirstActivity.this,YourSecondActivity.class);
mIntent.putExtra("position",position);
mIntent.putParcelableArrayListExtra("filedata",parcelableArrayList);
startActivity(mIntent);

for getting intent data into second activity,

int Position = getIntent().getIntExtra("position",0);
parcelableArrayList = getIntent().getParcelableArrayListExtra("filedata");
varotariya vajsi
  • 3,965
  • 37
  • 39