将一个String中的String传递给Android中的另一个Activity这是我的字符串:private final String easyPuzzle ="630208010200050089109060030"+
"008006050000187000060500900"+
"09007010681002000502003097";我想在9 * 9数独板上的另一个活动上显示这个字符串。
3 回答
守候你守候我
TA贡献1802条经验 获得超10个赞
您需要将其作为额外传递:
String easyPuzzle = "630208010200050089109060030"+ "008006050000187000060500900"+ "09007010681002000502003097";Intent i = new Intent(this, ToClass.class);i.putExtra("epuzzle", easyPuzzle);startActivity(i);
然后从您的新活动中提取它,如下所示:
Intent intent = getIntent();String easyPuzzle = intent.getExtras().getString("epuzzle");
紫衣仙女
TA贡献1839条经验 获得超15个赞
在activity1
String easyPuzzle = "630208010200050089109060030"+ "008006050000187000060500900"+ "09007010681002000502003097"; Intent i = new Intent (this, activity2.class); i.putExtra("puzzle", easyPuzzle); startActivity(i);
在活动2
Intent i = getIntent(); String easyPuzzle = i.getStringExtra("puzzle");
- 3 回答
- 0 关注
- 586 浏览
添加回答
举报
0/150
提交
取消