效果圖以下,當我從第一個界面選擇供應商的時候,我但願能獲得第二個界面選擇的供應商的值:ide
具體代碼,這裏第二個參數爲自定義的大於等於0的數字,用來標記當前跳轉。spa
Intent i1 = new Intent(context, GysInfo.class); startActivityForResult(i1, 3);
回傳數據的Activity處理code
Bundle bundle = new Bundle(); bundle.putString("name", item.getString("GYS_NAME")); bundle.putString("id", item.getString("GYS_ID")); Intent intent = new Intent(); intent.putExtras(bundle); setResult(RESULT_OK, intent);
跳轉Activity接收數據blog
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub if(resultCode == RESULT_OK){ Bundle bundle = data.getExtras(); String name = bundle.getString("name"); String id = bundle.getString("id"); AndroidUtils.showToast(context, "當前選擇的供應商爲:"+name); } }