Source:
SurfaceView sv=(SurfaceView) the findViewByID (R.i d.v ideoview);
Parcel request=Parcel. Obtain ();
Sv. GetHolder (). GetSurface () writeToParcel (request, 0);
Request. SetDataPosition (0);
The Log i. (TAG, "read the string" + request. ReadString ());
CodePudding user response:
Public class Surface implements Parcelable
Want to read the content of the Parce, must want to write in the Parcel first,
Your Parcel request=Parcel. Obtain (); Only initialization, didn't write any content, request. The readString () must be empty,
You need this request. WriteString (" ");
CodePudding user response:
But not in Surface writeToParcel interface has written a string?After call writeToParcel why can't we get this string?

CodePudding user response:
That's because the underlying has been read, write in to read and the content of the releaseCodePudding user response:
What is this place writeToParcel interface functionality? Call after the parcel is empty,,,I'm here to the surface object encapsulation in the parcel, then through written jni interface will parcel to the native layer on my side, don't want to add the jni interface pass this surface,
But I now is in the Java layer after call writeToParcel, this parcel is as empty, let alone a native layer
CodePudding user response:
Jni layer surface, and can not directly convert ANativeWindow?CodePudding user response:
The