【发布时间】:2016-01-29 17:33:45
【问题描述】:
我正在创建应用程序,其中我从 RadioGroup 获取单选按钮值 当我比较 if 语句中的值时,它不起作用。这是我正在使用的 Java 代码。
if(radioQuizeGroup.getText() == "History"){
Log.d("History", "Activity");
Toast.makeText(StartQuize.this,"History sss ss ", Toast.LENGTH_SHORT).show();
}
else{
Log.d("History", "Error ");
}
我在错误日志中出现错误,
这是错误日志
01-05 07:15:02.885: D/gralloc_goldfish(2035): Emulator without GPU emulation detected.
01-05 07:15:04.165: I/Choreographer(2035): Skipped 43 frames! The application may be doing too much work on its main thread.
01-05 07:15:05.245: D/dalvikvm(2035): GC_FOR_ALLOC freed 86K, 5% free 3139K/3280K, paused 18ms, total 32ms
01-05 07:15:15.236: D/History(2035): Error
请帮帮我
【问题讨论】:
-
您不会收到错误消息(如果 radiogroup 不为空),您的消息应该显示在调试日志级别中。你调试过你的代码吗?
-
我没有找到带有广播组的 getText()
-
logcate已更新,请查看@Manu Zi