简体   繁体   English

为具有不同资源的不同按钮启动相同的活动

[英]Launch the same activity for different buttons with different resource

我是Android的新手,它是通过列出button.i来开始的。我希望当每个按钮单击时,使用不同的资源(例如图像和原始文件)为它们启动相同的活动

what is big deal here? 这有什么大不了的?

call same intent twice :) 两次调用相同的意图:)

refer how to start new activity here 在这里参考如何开始新活动

You can the same activity/intent multiple times, just if you want the code in said activity to do something else you might want give it some extra information by using intent.putInt(<Key>, <Value>); 您可以多次使用相同的活动/意图,就算您希望上述活动中的代码执行其他操作,也可以使用intent.putInt(<Key>, <Value>);给它一些额外的信息intent.putInt(<Key>, <Value>); and others 和别的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM