I have an application that determines which path of execution to take based on the selected RadioButton
inside a RadioGroup
.
The program force closes with an InvocationTargetException
when the following fragment of code runs :
private int getselctedRadioButtonId() {
RadioGroup group = (RadioGroup) findViewById(R.id.radioGroup1);
return group.getCheckedRadioButtonId();
}
What am I doing wrong?
I can post more code, but I think this is the problematic part.
I'm targeting Android 2.2.
Edit: here's the full stack trace for the main thread:
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]