與錯誤serialazble我想就在serialazble如何設置setArgument
這個代碼,但我DK爲什麼, 在setArguments,有一個紅色下劃線,因此不能運行代碼。
有人可以指導我嗎?
public void summaryClick (View v)
{
Intent sum = new Intent(this, summary.class);
fuelLogPojo clickedObject = pojoArrayList.get(0);
Bundle dataBundle = new Bundle();
dataBundle.putString("clickedID", clickedObject.getid());
dataBundle.putString("clickedDate", clickedObject.getdate());
dataBundle.putString("clickedPrice", clickedObject.getprice());
dataBundle.putString("clickedPump", clickedObject.getpump());
dataBundle.putString("clickedCost", clickedObject.getcost());
dataBundle.putString("clickedOdometer", clickedObject.getodometer());
dataBundle.putString("clickedpreOdometer",
clickedObject.getpreodometer());
dataBundle.putString("clickedFCon", clickedObject.getfcon());
dataBundle.putSerializable("pojoArrayList", pojoArrayList);
Log.i("FuelLog", "dataBundle " + dataBundle);
// Attach the bundled data to the intent
// sum.putExtras(dataBundle);
sum.setArguments(dataBundle);
// Start the Activity
startActivity(sum);
}
取參考從這裏 passing a list of data from one intent to another using serializable
你可以發佈你收到的錯誤嗎? – Niko
嚴重嗎?只需更改sum.setArguments(bundle); sum.setArguments(dataBundle); :) – alex
@Niko有一個超過setArguements這個詞的紅線。我徘徊在它,並被告知添加演員總和。我按照說明,但仍然紅線 – Chloe