button - How to set a listener in a RadioButton - Android -


I have 3 radio buttons in 3 different linear layouts. I, I can not have a radio group.

How do I set up listeners? I try with the On-Check Listener:

  RadioButton Badchauge = (Radio Button) SearchVBIID (RID.badokiz); badChoise.setOnCheckedChangeListener (New OnCheckedChangeListener () {@Override public void onCheckedChanged (CompoundButton buttonView, Boolean isChecked) {// TODO Auto-not manufactured method stub // I need to determine what I buttonView, and isChecked} < / Code> 

If I have set onClickListener on my radio button, then I have this error:

  10-28 13: 06: 10.893: E / Android time (29179) ): FATAL Exceptions: Main 10-28 13: 06: 10.893: E / AndroidRuntime (29179): java.lang.NullPointerException 10-28 13: 06: 10.893: E / AndroidRuntime (29179): com.example.survey.Survey At $ 1. OnClick (Survey.java:73) 10-28 13: 06: 10.893: E / Android Rentaim (29179) on Android. View.View.performClick (see. Java: 4377) 10-28 13: 06: 10.893: E / AndroidRuntime (29179): android.view.View $ PerformClick.run (View.java:18044) at 10-28 13: 06: 10.893: E / AndroidRuntime (29179): android.os.Handler.handleCallback (Handl Er.java:725) 10-28 13: 06 : 10.893: E / Android Random (29179): Android.OS Handler Diskpacmel (Handlrkjawaः 92) 10-28 13: 06: 10.893: E / Androidrentm (29179): 10-28 13 android.os.Looper.loop (Looper.java:137): 06: 10.893: E / AndroidRuntime (29179): android.app.ActivityThread.main (on ActivityThread.java:5306) 10 -28 13: 06: 10.893: e / Androidrentaim (29179) on JavaklangkreflectkMethodkinvokeNative (Basic Law) 10 -28 13: 06: 10.893: E / Android timeTime (29179): at java.lang. On reflect.Method.invoke (Method.java:511) 10-28 13: 06: 10.893: E / AndroidRuntime (29179): com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:1102) 10 -28 13: 06: 10.893: e / AndroidRuntime (29179): com.android.internal.os.ZygoteInit.main (ZygoteInit.java:869) 10-28 13: 06: 10.893: e / AndroidRuntime (29179) on: Can anyone help me? 

"text">

use radio group And use the EtCheckedRadioButtonId () function.


Comments