android - Send list of objects which contain other custom objects from one activity to another -
This is my class whose list I want to send to another activity.
Public class posts comments {from public user; Public string message; Public string creation time; Public string like_count; Public boolean user_likes; } This user group whose object is used in the PostComments class
the public class user extends BaseEntity {public string photoUrl. } and this basepoint class
public square baseInte {public string ID; The name of the public string; } How can I send this object from one activity to another
PostComments [] MyData = ClickedPost.comments.data? Content postcomments = new (getActivity), PostCommentsActivity.class); . GetActivity () startActivity (PostCommentsActivity); The above is the code to open PostCommentsActivity and I want to send a MyData object to PostCommentsActivity.
I have searched a lot about this problem but every question and tutorial that explain only one class for simple string, integer or boolean variables
try:.
ArrayList & LT; PostComments & gt; Comments = New Arrestists & lt; Main activity. Post Comments & gt; (); Comments.add (...) // Add your list data here Intent Intent = new intent (getActivity (), PostCommentsActivity.class); Intent.putExtra ("list_comments", comments); . GetActivity () startActivity; and edit your post-committance class in the following:
Public category posts comrades serializable {public string message; Public string creation time; Public string like_count; Public boolean user_likes; } In PostCommentsActivity, get bundle to get list comments.
Comments
Post a Comment