我有一个应用程序,它根据RadioButton
在RadioGroup
.
InvocationTargetException
当以下代码片段运行时,程序强制关闭:
private int getselctedRadioButtonId() {
RadioGroup group = (RadioGroup) findViewById(R.id.radioGroup1);
return group.getCheckedRadioButtonId();
}
我究竟做错了什么?
我可以发布更多代码,但我认为这是有问题的部分。
我的目标是Android 2.2。
编辑:这是主线程的完整堆栈跟踪:
Thread [<1> main] (Suspended (exception IllegalStateException))
View$1.onClick(View) line: 2072
Button(View).performClick() line: 2408
View$PerformClick.run() line: 8816
ViewRoot(Handler).handleCallback(Message) line: 587
ViewRoot(Handler).dispatchMessage(Message) line: 92
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]