【发布时间】:2019-08-09 11:00:12
【问题描述】:
我正在将对象从SurfaceInspectionListActivity 发送到AddSurfaceInspectionActivity
在 putExtra 上我可以在调试模式下看到数据,但是在检索数据时我得到 NULL
我尝试将其作为字符串获取,以进行也导致 NULL 的测试
surfaceObjString = getIntent().getStringExtra("myjsonSurfaceObject2");
这是SurfaceInspectionListActivity Intent 代码
public void addSurfaceInspection(View view) {
Intent intent = new Intent(SurfaceInspectionListActivity.this, AddSurfaceInspectionActivity.class);
intent.putExtra("myjsonSurfaceObject2", surfaceObject);
startActivity(intent);
finish();
}
这是AddSurfaceInspectionActivity上的检索码
Gson gson = new Gson();
surfaceObj = gson.fromJson(getIntent().getStringExtra("myjsonSurfaceObject2"), Surfaces.class);
【问题讨论】:
标签: android string android-intent gson