我有一個應用程序根據RadioGroup
中選定的RadioButton
確定執行哪個執行路徑。InvocationTargetException當確定在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]
InvocationTargetException封裝了另一個異常,你能告訴我們什麼是基礎異常嗎? – MByD
@MByD我該怎麼做?我正在使用Eclipse和ADT插件。 –
在Eclipse上進行調試。當你看到Debug窗口出現異常時。或者,查看debug/DDMS窗口中的logcat框。 – MByD