java.lang.RuntimeException: Parcelable encountered IOException writing serializable
I have an arraylist
that i want to send from 1 activity to another, I am using serializable but end up getting following error message.
java.lang.RuntimeException: Parcelable encountered IOException
writing serializable object (name = com.app...)
I have also reviewed some question regarding this on SO
, most of them saying that all classes defined inside your Serialized
class should also implement Serializable
, but here Path
, 'RectF', Matrix
, are not my classes, they are android classes, and i can't implement Serializable
in these classes.
This is how i am sending array list from 1 activity to another.
Intent intent= new Intent(MainActivity.this, DetailsActivity.class);
Bundle bundle= new Bundle();
bundle.putSerializable("PATH_LIST", pathsList);
bundle.putString("FILE_NAME", fileName);
intent.putExtras(bundle);
startActivity(intent);
and this is my class.
public class TData implements Serializable {
Matrix originalMatrix;
public Path path;
PointF position;
private TData attachedPathData;
public void setAttachedPathData(TData pathData){
attachedPathData = pathData;
}
public TData getAttachedPathData(){
return attachedPathData;
}
public TData(){
}
public TData(Path path, PointF position, String id, String fillColor, String strokeColor){
this.path = path;
this.position = position;
this.id = id;
this.fillColor = fillColor;
this.strokeColor = strokeColor;
}
public void Scale(float scaleX, float scaleY){
this.scaleX = scaleX;
this.scaleY = scaleY;
Matrix scaleMatrix = new Matrix();
RectF rectF = new RectF();
path.computeBounds(rectF, true);
scaleMatrix.setScale(scaleX,scaleY);
path.transform(scaleMatrix);
Matrix mat = new Matrix();
path.computeBounds(rf, true);
Region r = new Region();
}
}
android android-intent serializable android-bundle
add a comment |
I have an arraylist
that i want to send from 1 activity to another, I am using serializable but end up getting following error message.
java.lang.RuntimeException: Parcelable encountered IOException
writing serializable object (name = com.app...)
I have also reviewed some question regarding this on SO
, most of them saying that all classes defined inside your Serialized
class should also implement Serializable
, but here Path
, 'RectF', Matrix
, are not my classes, they are android classes, and i can't implement Serializable
in these classes.
This is how i am sending array list from 1 activity to another.
Intent intent= new Intent(MainActivity.this, DetailsActivity.class);
Bundle bundle= new Bundle();
bundle.putSerializable("PATH_LIST", pathsList);
bundle.putString("FILE_NAME", fileName);
intent.putExtras(bundle);
startActivity(intent);
and this is my class.
public class TData implements Serializable {
Matrix originalMatrix;
public Path path;
PointF position;
private TData attachedPathData;
public void setAttachedPathData(TData pathData){
attachedPathData = pathData;
}
public TData getAttachedPathData(){
return attachedPathData;
}
public TData(){
}
public TData(Path path, PointF position, String id, String fillColor, String strokeColor){
this.path = path;
this.position = position;
this.id = id;
this.fillColor = fillColor;
this.strokeColor = strokeColor;
}
public void Scale(float scaleX, float scaleY){
this.scaleX = scaleX;
this.scaleY = scaleY;
Matrix scaleMatrix = new Matrix();
RectF rectF = new RectF();
path.computeBounds(rectF, true);
scaleMatrix.setScale(scaleX,scaleY);
path.transform(scaleMatrix);
Matrix mat = new Matrix();
path.computeBounds(rf, true);
Region r = new Region();
}
}
android android-intent serializable android-bundle
1
In the future, please post the entire stack trace, not just the error message.
– CommonsWare
Nov 24 '18 at 16:10
add a comment |
I have an arraylist
that i want to send from 1 activity to another, I am using serializable but end up getting following error message.
java.lang.RuntimeException: Parcelable encountered IOException
writing serializable object (name = com.app...)
I have also reviewed some question regarding this on SO
, most of them saying that all classes defined inside your Serialized
class should also implement Serializable
, but here Path
, 'RectF', Matrix
, are not my classes, they are android classes, and i can't implement Serializable
in these classes.
This is how i am sending array list from 1 activity to another.
Intent intent= new Intent(MainActivity.this, DetailsActivity.class);
Bundle bundle= new Bundle();
bundle.putSerializable("PATH_LIST", pathsList);
bundle.putString("FILE_NAME", fileName);
intent.putExtras(bundle);
startActivity(intent);
and this is my class.
public class TData implements Serializable {
Matrix originalMatrix;
public Path path;
PointF position;
private TData attachedPathData;
public void setAttachedPathData(TData pathData){
attachedPathData = pathData;
}
public TData getAttachedPathData(){
return attachedPathData;
}
public TData(){
}
public TData(Path path, PointF position, String id, String fillColor, String strokeColor){
this.path = path;
this.position = position;
this.id = id;
this.fillColor = fillColor;
this.strokeColor = strokeColor;
}
public void Scale(float scaleX, float scaleY){
this.scaleX = scaleX;
this.scaleY = scaleY;
Matrix scaleMatrix = new Matrix();
RectF rectF = new RectF();
path.computeBounds(rectF, true);
scaleMatrix.setScale(scaleX,scaleY);
path.transform(scaleMatrix);
Matrix mat = new Matrix();
path.computeBounds(rf, true);
Region r = new Region();
}
}
android android-intent serializable android-bundle
I have an arraylist
that i want to send from 1 activity to another, I am using serializable but end up getting following error message.
java.lang.RuntimeException: Parcelable encountered IOException
writing serializable object (name = com.app...)
I have also reviewed some question regarding this on SO
, most of them saying that all classes defined inside your Serialized
class should also implement Serializable
, but here Path
, 'RectF', Matrix
, are not my classes, they are android classes, and i can't implement Serializable
in these classes.
This is how i am sending array list from 1 activity to another.
Intent intent= new Intent(MainActivity.this, DetailsActivity.class);
Bundle bundle= new Bundle();
bundle.putSerializable("PATH_LIST", pathsList);
bundle.putString("FILE_NAME", fileName);
intent.putExtras(bundle);
startActivity(intent);
and this is my class.
public class TData implements Serializable {
Matrix originalMatrix;
public Path path;
PointF position;
private TData attachedPathData;
public void setAttachedPathData(TData pathData){
attachedPathData = pathData;
}
public TData getAttachedPathData(){
return attachedPathData;
}
public TData(){
}
public TData(Path path, PointF position, String id, String fillColor, String strokeColor){
this.path = path;
this.position = position;
this.id = id;
this.fillColor = fillColor;
this.strokeColor = strokeColor;
}
public void Scale(float scaleX, float scaleY){
this.scaleX = scaleX;
this.scaleY = scaleY;
Matrix scaleMatrix = new Matrix();
RectF rectF = new RectF();
path.computeBounds(rectF, true);
scaleMatrix.setScale(scaleX,scaleY);
path.transform(scaleMatrix);
Matrix mat = new Matrix();
path.computeBounds(rf, true);
Region r = new Region();
}
}
android android-intent serializable android-bundle
android android-intent serializable android-bundle
asked Nov 24 '18 at 15:41
Kirmani88Kirmani88
1,17172059
1,17172059
1
In the future, please post the entire stack trace, not just the error message.
– CommonsWare
Nov 24 '18 at 16:10
add a comment |
1
In the future, please post the entire stack trace, not just the error message.
– CommonsWare
Nov 24 '18 at 16:10
1
1
In the future, please post the entire stack trace, not just the error message.
– CommonsWare
Nov 24 '18 at 16:10
In the future, please post the entire stack trace, not just the error message.
– CommonsWare
Nov 24 '18 at 16:10
add a comment |
1 Answer
1
active
oldest
votes
here Path, 'RectF', Matrix, are not my classes, they are android classes, and i can't implement Serializable in these classes..
Then do not have fields for them in Serializable
classes.
Either:
Do not have separate activities here, but do something else instead (e.g., one activity and two fragments) that avoids the need for the
Intent
, orDo not pass this data between the activities, but instead use a different application architecture (e.g., the data is not held by either activity, but instead is held by a repository that both activities can talk to), or
Create some data structure that you can make
Parceable
orSerializable
, from which you can rebuild your model objects with their desired classes, and pass thatParcelable
/Serializable
data structure in theIntent
instead ofTData
add a comment |
Your Answer
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%2f53459746%2fjava-lang-runtimeexception-parcelable-encountered-ioexception-writing-serializa%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
here Path, 'RectF', Matrix, are not my classes, they are android classes, and i can't implement Serializable in these classes..
Then do not have fields for them in Serializable
classes.
Either:
Do not have separate activities here, but do something else instead (e.g., one activity and two fragments) that avoids the need for the
Intent
, orDo not pass this data between the activities, but instead use a different application architecture (e.g., the data is not held by either activity, but instead is held by a repository that both activities can talk to), or
Create some data structure that you can make
Parceable
orSerializable
, from which you can rebuild your model objects with their desired classes, and pass thatParcelable
/Serializable
data structure in theIntent
instead ofTData
add a comment |
here Path, 'RectF', Matrix, are not my classes, they are android classes, and i can't implement Serializable in these classes..
Then do not have fields for them in Serializable
classes.
Either:
Do not have separate activities here, but do something else instead (e.g., one activity and two fragments) that avoids the need for the
Intent
, orDo not pass this data between the activities, but instead use a different application architecture (e.g., the data is not held by either activity, but instead is held by a repository that both activities can talk to), or
Create some data structure that you can make
Parceable
orSerializable
, from which you can rebuild your model objects with their desired classes, and pass thatParcelable
/Serializable
data structure in theIntent
instead ofTData
add a comment |
here Path, 'RectF', Matrix, are not my classes, they are android classes, and i can't implement Serializable in these classes..
Then do not have fields for them in Serializable
classes.
Either:
Do not have separate activities here, but do something else instead (e.g., one activity and two fragments) that avoids the need for the
Intent
, orDo not pass this data between the activities, but instead use a different application architecture (e.g., the data is not held by either activity, but instead is held by a repository that both activities can talk to), or
Create some data structure that you can make
Parceable
orSerializable
, from which you can rebuild your model objects with their desired classes, and pass thatParcelable
/Serializable
data structure in theIntent
instead ofTData
here Path, 'RectF', Matrix, are not my classes, they are android classes, and i can't implement Serializable in these classes..
Then do not have fields for them in Serializable
classes.
Either:
Do not have separate activities here, but do something else instead (e.g., one activity and two fragments) that avoids the need for the
Intent
, orDo not pass this data between the activities, but instead use a different application architecture (e.g., the data is not held by either activity, but instead is held by a repository that both activities can talk to), or
Create some data structure that you can make
Parceable
orSerializable
, from which you can rebuild your model objects with their desired classes, and pass thatParcelable
/Serializable
data structure in theIntent
instead ofTData
answered Nov 24 '18 at 16:11
CommonsWareCommonsWare
767k13818721922
767k13818721922
add a comment |
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%2f53459746%2fjava-lang-runtimeexception-parcelable-encountered-ioexception-writing-serializa%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
1
In the future, please post the entire stack trace, not just the error message.
– CommonsWare
Nov 24 '18 at 16:10