尝试将HashMap传递给我的MainActivity类时,我收到以下错误(TabooCards实现了Serializable).我在这里读到HashMap是可序列化的,并且HashMap中包含的任何对象也必须是可序列化的.我假设Integer是可序列化的,我知道TabooCards是可序列化的,所以出了什么问题?
码:
AsyncTask onPostExecute:
protected void onPostExecute(HashMap<Integer, TabooCard> result) {
super.onPostExecute(result);
Intent i = new Intent(getBaseContext(), MainActivity.class);
i.putExtra("TABOO_CARDS", tabooCards);
startActivity(i);
}
Run Code Online (Sandbox Code Playgroud)
TabooCards:
public class TabooCard implements Serializable{
/**
*
*/
private static final long serialVersionUID = -6996042490365349623L;
String mainWord, taboo1, taboo2, taboo3, taboo4, taboo5;
public TabooCard() {
this("Main Card", "Taboo 1", "Taboo 2", "Taboo 3", "Taboo 4", "Taboo 5");
}
public TabooCard(String mainword, String taboo1, String taboo2, String taboo3, String taboo4, String taboo5) {
setMainWord(mainword);
setTaboo1(taboo1); …Run Code Online (Sandbox Code Playgroud)