我正在将值从Activity Ato传递Activity B。它工作正常。例如,如果我传递 String "Harvey Brown",那么在下一个活动中它也会显示"Harvey Brown".但我还想"Author: "在之前添加文本"Harvey Brown"并显示总和结果TextView,现在而不是仅 "Harvey Brown".它会显示Author:Harvey Brown对于每个意图。这是代码,我用来传递字符串值: intent.putExtra("Title",mData.get(position).getTitle());在接下来的活动中,我收到了价值Intent intent = getIntent(); String author_name = intent.getExtras().getString("author_name");我相应地将值设置为 author_name = (TextView) findViewById(R.id.author_nameid); author_name.setText(author_name);
2 回答
森林海
TA贡献2011条经验 获得超2个赞
解决方案:
只需更改这一行:
intent.putExtra("Title",mData.get(position).getTitle());
到
intent.putExtra("Title", "Author: " + mData.get(position).getTitle());
你会得到你想要的结果。
添加回答
举报
0/150
提交
取消