radio button - Can not get the result of RadioButton onchecked() in Android -


I can not get a value to come back Agree I can not get the value back from i_am.isChecked () for all other radio buttons.

  Safe vs. creation (bundle saved instanestate) {Last radio button i_am, practices, read_terms; I_am = (RadioButton) findViewById (R.id.first); Practice = (RadioButton) findViewById (R.id.second); Read_terms = (RadioButton) findViewById (R.id.third); // TODO auto generate method stub super. Connet (Saved InstanceStat); SetContentView (R.layout.termandconditionxml); Button agree_button = (button) findViewById (R.id.Agree); Agree (0) LENGTH_LONG) .show ();} else {// TODO auto-generated method stub new alertology. Builder (rule and end) .setTitle ("Error"). Set permissions ("Please verify") .setPositiveButton ("OK", null) .show ();}} Private Boolean Checker () {/ TODO Auto-Generated Method Stub System .out.printline ("iamanhcp" + i_am.isChecked ()); If (i_am.isChecked ()) {system. If (read_terms.isChecked ()) {out.println ("iahcp" + i_am.isChecked ()); If (practice.isChecked ()) {System.out.println ("iama" + practice.isChecked ()); System.out.println ("iama" + read_terms.is check ()); Return true;}}} return false;}}); } // sorat end   

============================

  07-05 15: 36: 14.301: w / dalvikum (1702): thread = 1: thread with no exception (group = 0x40014760) 07-05 15: 36: 14.332: E / endocrinetime (1702) ): Fatal Exception: Main 07-05 15: 36: 14.332: E / Android Random (1702): java.lang.NullPointerException 07-05-2013 15: 36: 14.332: E / Androindertime (1702): at com.andoid. Terms and Conditions $ 1. Check (Termsandcondition.java:53) 07-05 15: 36: 14.332: E / Android Random (1702): at com.andoid. Terms and Conditions $ 1.onClick (Termsandcondition.java36) 07-05 15: 36: 14.332: E / Android Random (1702): Android. View.View.performClick (see .Java3110) 07-05 15: 36: 14.332: E / Android Random (1702): On Android. Android View $ PerformClick.run (see .Java): 11934) 07-05 15: 36: 14.332: E / Android Random (1702): Callback (HandlerJava Litre 87) on Android.OS.HandlerHandle 07-05-2015: 36: 14.332: E / Android TimeTime (1702): Android.OS Handler Dispatch Message (Handler.Java: 92) 07-05 15: 36: 14.332: E / Androindertime (1702): Android. On . Loop Loop (Looper.java:132) 07-05 15: 36: 14.332: E / Android Random (1702): Android. App ActivateTrade.Mine (ActivityTrad.Jewski 123) 07-05-2013 15: 36: 14.332: E / AndroidRuntime (1702): at java.lang.reflect.Method.invokeNative (Basic Method) 07-05 15: 36: 14.332: E / AndroidTime (1702): java.lang.reflect.Method.invoke at (Method .java: 491) 07-05 15: 36: 14.332: E / Androindertime (1702): com.android.internal.os.ZygoteInit $ MethodAndArgsCaller Run on (ZygoteInit.java:841) 07-05 15: 36: 14.332: E / AndroidRuntime (1702): com.android.internal.os.ZygoteInit.main (ZygoteInit.java.199) on 07-05-2015: 36 : 14.332: E / Androindertime (1702): On Dalvik.system.NativeStart. Main (basic method)    

Your getApplicationContext In your Toast Instead use this to get a value from your RadioButton s, use the On Checked Change Listener .

  Toast. Maketext (this, "all clipped", toast LENGTH_LONG) .show ();   

and

  i_am.setOnCheckedChangeListener (this);   

Hope this helps you.

Comments