如何更改int值onclick并将其传递给另一个活动?在android上? [英] How to change the int value onclick and pass it to another activity ? on android?
本文介绍了如何更改int值onclick并将其传递给另一个活动?在android上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我单击(按钮x)并将int x值传递给另一个活动时,我想更改(int x).并在我单击(按钮y)并将其y值传递给另一个活动时更改(int y).
I want to change (int x) when i click on (button x) and pass int x value to another activity. and change (int y) when i click on (button y) and pass int y value to another activity.
如何在android上做到这一点?
how to do that on android ?
推荐答案
1个活动
int x=value;
Intent i=new Intent(this, secActiv.class);
i.putintextra("x",x);
startactivity(i)
2活动
oncreate(){...
Intent i=getintent();
int x=i.getintextra("x",null);
这篇关于如何更改int值onclick并将其传递给另一个活动?在android上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文