0
我有一个小问题,我卡住了。问题是我已经通过一个代码下面的代码。我无法检索通过putExtra传递给Activity的数据?
Intent i = new Intent(First.this,Second.class);
i.putExtra("classification_id","3");
但是,当我尝试使用下面的代码获取参数3时,我在调试模式下检查它时得到-1的结果。
if(intent.getExtras().getString("classification_id")!=null){
classId = intent.getExtras().getString("classification_id");
}else{
classId = "1";
}
其实我想用这个参数设置成一个url来获取json数据来获取json数据。但这是一个正确的方式吗?或者是否将String int设置为url是一种糟糕的做法?防爆。 "www.test.test/myid?="+classId
谢谢!问题解决了 ! – user3264924