Android 我想把我从以前的活动中得到的文本设置为意图?
/我的意图有问题,无法设置我从上一个活动获取的getIntent中获取的text/更改此项:Android 我想把我从以前的活动中得到的文本设置为意图?,android,android-intent,Android,Android Intent,/我的意图有问题,无法设置我从上一个活动获取的getIntent中获取的text/更改此项: /*I have problem with intent that i can't settext which i have got from getIntent from previous activity*/ public class Done extends Activity { @Override protected void onCreat
/*I have problem with intent that i can't settext which i have got from getIntent from previous activity*/
public class Done extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_done);
TextView text = (TextView)findViewById(R.id.donetxt);
int tappedapples=0;
RelativeLayout rl = (RelativeLayout)findViewById(R.id.RelativeLayout);
rl.setBackgroundResource(R.drawable.background);
/*I want to setText which i have got from previous activity*/
Bundle extras = getIntent().getExtras();
if(extras!=null){
int apples = extras.getInt("tappedapples",0);
text.setText(Integer.parseInt("tappedapples"));
}
}
}
致:
雅皮士正在工作,我想画出用户在结果中收集到的对象activity@donfuxx+1谢谢你的精彩回答。如果我想为我的应用程序制作教程,怎么做?你的应用程序制作教程是什么意思@用户3248914是否可以截屏视频并上传到youtube?
int apples = extras.getInt("tappedapples",0);
text.setText(Integer.parseInt("tappedapples"));
int apples = extras.getInt("tappedapples",0);
text.setText(apples+"");