When trying to replace
model = getIntent().getParcelableExtra("key"); On
model = getIntent().getSerializableExtra("key"); I am underlined by a line with an error about a type mismatch
Required com.project.app.Person.person
but
Found java.io.Serializable
. Please tell me how to fix it.
Model class:
public class Model implements Serializable { @SerializedName("name") @Expose private String name; @SerializedName("products") @Expose private Integer products; public String getName() { return name; public Integer getProducts() { return products; } In the adapter I transmit as follows
public void startActivity(TopStoriesAdapter.ViewHolder viewHolder) { Intent intent = new Intent(context, TopStoryDetailActivity.class); intent.putExtra("key", topStoriesList.get(viewHolder.getAdapterPosition())); context.startActivity(intent); }
modelobject? Show this class. - post_zeewtopStoriesList? Show the line with the declaration of this variable. - post_zeew