我通過使用新的Intent像下面的代碼那樣將一個活動的值傳遞給另一個活動,但是當我想從另一個活動獲取傳遞值時,它會顯示值爲null。從那裏數據被傳遞如何使用新的意圖解決從一個活動到另一個活動的傳遞價值?
Intent intent = new Intent();
Log.e("Pass Profile Name: ",""+profileName.getText());
intent.putExtra("profileName",profileName.getText());
setResult(RESULT_OK,intent);
finish();
次活動得到了傳遞數據的代碼
String pName = getIntent().getStringExtra("profileName");
Log.e("Profile Name",""+pName);
和PNAME
第一個活動是空here.Can有人幫助我,這是爲什麼發生。 ..
檢查返回profileName.getText() – USKMobility
的價值我用檢查返回值一個logcat,它返回正確的值 這是日誌放在字符串 Log.e(「P屁股配置文件名稱:「,」「+ profileName.getText()); – opu
@opu,請發佈您的所有代碼或至少完成的部分,在其中設置附加組件並接收它,它可以幫助理解大圖,並可能記錄缺少的變量或其他內容。另請發佈錯誤跟蹤。 – Robert