I submit an object of my custom class that implements Serializable:
public class MyObject extends ParseObject implements Serializable { private static final long serialVersionUID = 1L; public MyObject() { } public String getTitle() { return getString("title"); } public void setTitle(String title) { put("title", title); } public ParseFile getParseFile() { return getParseFile("file"); } public void setParseFile(ParseFile file) { put("file", file); } }
The class contains atm one line and one ParseFile.
I am trying to transfer an object from one action to another.
private void editMyObject(MyObject myObject) { Intent intent = new Intent(AActivity.this, BActivity.class); intent.putExtra("MyObject", myObject); Toast.makeText(getApplicationContext(), "OUT: "+myObject.getTitle(), Toast.LENGTH_SHORT).show();
And in the work of 'receiver':
protected void onCreate(Bundle savedInstanceState) { ... Intent intent = getIntent(); myObject = (MyObject)intent.getSerializableExtra("MyObject"); if (myObject != null) { editText.setText(myObject.getTitle()); } Toast.makeText(getApplicationContext(), "IN: "+myObject.getTitle(), Toast.LENGTH_SHORT).show();
What am I doing wrong...? I followed other questions on SOF, but that didn't help;) BTW: No, ParseFile is a class from Developer Collaboration
source share