1
我試圖讓顯示敬酒的結果,但在該行Plant plant = (Plant) data.getSerializableExtra(PlantResultActivity.PLANT_RESULT);
未能提供結果ResultInfo(誰= NULL,請求= 1,結果爲0,數據= NULL)
PlantResultActivity應用程序崩潰:
\t @Override
\t protected void onListItemClick(ListView l, View v, int position, long id) {
\t \t // TODO Auto-generated method stub
\t \t super.onListItemClick(l, v, position, id);
\t \t // get the item that the user clicked
\t \t Plant plant = (Plant) getListAdapter().getItem(position);
\t \t // EveryThing went fine
\t \t getIntent().putExtra(PLANT_RESULT, plant);
\t \t // Finish this Intent
\t \t finish();
\t }
AdvancedSearchActivity:
\t @Override
\t protected void onActivityResult(int requestCode, int resultCode, Intent data) {
\t \t // TODO Auto-generated method stub
\t \t super.onActivityResult(requestCode, resultCode, data);
\t \t //are we getting data returend from the plantResultIntent? If so, this if test will evaluate to true, because
\t \t //we passed the PLANT_RESULTS constant in when invoked that intent
\t \t if(requestCode == PLANT_RESULTS){
\t \t \t //fetch the selected data using the constant that we have using as a key
\t \t \t Plant plant = (Plant) data.getSerializableExtra(PlantResultActivity.PLANT_RESULT);
\t \t \t
\t \t \t //This Toast will be invoked if we recieved a result from plantResultIntent
\t \t \t Toast.makeText(this, "Recieved Result " + plant, Toast.LENGTH_LONG).show();
\t \t \t
\t \t \t
\t \t }
\t }
爲我添加了錯誤的截圖一樣 – PPD 2015-01-21 10:34:11
提供的logcat在logcat窗口中! – ocean 2015-01-21 10:36:03