[英]How to display text in a new activity when two radio buttons from two different activities are clicked?
I am using Java and Android Studio.我正在使用 Java 和 Android 工作室。 I have one activity with a few options to select from, and once one of them is selected, they click the button that takes them to the next activity.
我有一个活动,其中包含 select 的几个选项,一旦选择其中一个,他们单击将它们带到下一个活动的按钮。 They do the same thing again except this time when the user clicks the button it takes them to a new activity where it displays the results based on the two radio buttons clicked previously.
他们再次做同样的事情,除了这次当用户单击按钮时,它会将他们带到一个新活动,在该活动中它会根据之前单击的两个单选按钮显示结果。 How can I do this?
我怎样才能做到这一点?
You cannot declare a method inside another method.您不能在另一个方法中声明一个方法。 Put a closing brace after onCreate.
在 onCreate 之后放置一个右大括号。
When you are opening a new activity, you are doing it with an Intent.当您打开一个新活动时,您是在使用 Intent 进行的。 Put the values you want to send (bool clicked) the new activity inside the intent
将您要发送的值(单击布尔值)放入意图中的新活动
You can send some variable through intent and onCreate() method of the second activity, you can use that variable to differentiate your functionality.您可以通过第二个活动的意图和 onCreate() 方法发送一些变量,您可以使用该变量来区分您的功能。 This video demonstrates the functionality of the radio button: https://youtu.be/zJG9Prn3vZ0 In this video you can know how to pass arguments to another activity: https://youtu.be/OMCctaE66b8 Hope that helps you to solve your problem.
This video demonstrates the functionality of the radio button: https://youtu.be/zJG9Prn3vZ0 In this video you can know how to pass arguments to another activity: https://youtu.be/OMCctaE66b8 Hope that helps you to solve your problem .
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.