[android-developers] Re: OnCheckedChangeListener not working on RadioGroup

2011-10-06 Thread KK
Would appreciate if someone could explicitly mention what exactly is
the fix for this error. As, I don't see any mention of compoundbutton
and the user has correctly used  RadioGroup.OnCheckedChangeListener
I'm stuck at the same point.

Thanks

On Aug 12, 3:58 pm, Mark Murphy mmur...@commonsware.com wrote:
 The error message is self-explanatory. You are trying to use
 a CompoundButton.OnCheckedChangeListener() in a place that takes
 a RadioGroup.OnCheckedChangeListener.









 On Fri, Aug 12, 2011 at 12:58 AM, shamir shakir dewswo...@gmail.com wrote:
  Hello,
  I was trying to add the CheckedChangeListner for RadioGroup and it's not
  working ... :(
  I'm using eclipse IDE. And I'm getting this error

  The method setOnCheckedChangeListener(RadioGroup.OnCheckedChangeListener)
  in the type RadioGroup is not applicable for the arguments (new
  CompoundButton.OnCheckedChangeListener(){})

  Here's the code

  package com.dewsworld.android.practise;

  import java.util.Date;

  import android.app.Activity;
  import android.content.Intent;
  import android.content.res.Resources.Theme;
  import android.graphics.drawable.GradientDrawable.Orientation;
  import android.os.Bundle;
  import android.os.Process;
  import android.provider.ContactsContract;
  import android.util.Log;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.AutoCompleteTextView;
  import android.widget.Button;
  import android.widget.CheckBox;
  import android.widget.Checkable;
  import android.widget.CompoundButton;
  import android.widget.CompoundButton.OnCheckedChangeListener;
  import android.widget.EditText;
  import android.widget.Gallery;
  import android.widget.LinearLayout;
  import android.widget.ProgressBar;
  import android.widget.QuickContactBadge;
  import android.widget.RadioGroup;
  import android.widget.TextView;
  import android.widget.Toast;
  import android.widget.ToggleButton;
  import android.widget.SimpleAdapter.ViewBinder;

  public class EntryPointActivity extends Activity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main) ;
   RadioGroup radioGroup = (RadioGroup)this.findViewById(R.id.rg) ;
   radioGroup.setOnCheckedChangeListener( new OnCheckedChangeListener() {
    @Override
   public void onCheckedChanged(RadioGroup group, int checkedId) {
   // ... :(
   }
   });
   }
  }

  Any kind of help is much more appreciated. Thanks

  --

         * Shamir Shakir*
          L-2, T-2, Grad. Student, B. Sc., Dept. of CSE,
          Military Institute of Science and Technology (MIST),
          Mirpur Cantonment, Dhaka, Bangladesh.

         www.dewsworld.info| dewswo...@gmail.com

   --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
 Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: OnCheckedChangeListener not working on RadioGroup

2011-10-06 Thread KK
I got it!. during creating the oncheckedchangelistener(), specifying
new  RadioGroup.OnCheckedChangeListener() instead of
just  OnCheckedChangeListener() fixed the problem.

Adding the sample code for others reference.

RadioGroup rdGroup = (RadioGroup) findViewById(R.id.rdbGp1);
rdGroup.setOnCheckedChangeListener(*new RadioGroup.OnCheckedChangeListener()
* {

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
 // TODO Auto-generated method stub

}
});


Thanks to all of you.

--KK

On Thu, Oct 6, 2011 at 8:54 PM, KK dioxide.softw...@gmail.com wrote:

 Would appreciate if someone could explicitly mention what exactly is
 the fix for this error. As, I don't see any mention of compoundbutton
 and the user has correctly used  RadioGroup.OnCheckedChangeListener
 I'm stuck at the same point.

 Thanks

 On Aug 12, 3:58 pm, Mark Murphy mmur...@commonsware.com wrote:
  The error message is self-explanatory. You are trying to use
  a CompoundButton.OnCheckedChangeListener() in a place that takes
  a RadioGroup.OnCheckedChangeListener.
 
 
 
 
 
 
 
 
 
  On Fri, Aug 12, 2011 at 12:58 AM, shamir shakir dewswo...@gmail.com
 wrote:
   Hello,
   I was trying to add the CheckedChangeListner for RadioGroup and it's
 not
   working ... :(
   I'm using eclipse IDE. And I'm getting this error
 
   The method
 setOnCheckedChangeListener(RadioGroup.OnCheckedChangeListener)
   in the type RadioGroup is not applicable for the arguments (new
   CompoundButton.OnCheckedChangeListener(){})
 
   Here's the code
 
   package com.dewsworld.android.practise;
 
   import java.util.Date;
 
   import android.app.Activity;
   import android.content.Intent;
   import android.content.res.Resources.Theme;
   import android.graphics.drawable.GradientDrawable.Orientation;
   import android.os.Bundle;
   import android.os.Process;
   import android.provider.ContactsContract;
   import android.util.Log;
   import android.view.View;
   import android.view.View.OnClickListener;
   import android.widget.AutoCompleteTextView;
   import android.widget.Button;
   import android.widget.CheckBox;
   import android.widget.Checkable;
   import android.widget.CompoundButton;
   import android.widget.CompoundButton.OnCheckedChangeListener;
   import android.widget.EditText;
   import android.widget.Gallery;
   import android.widget.LinearLayout;
   import android.widget.ProgressBar;
   import android.widget.QuickContactBadge;
   import android.widget.RadioGroup;
   import android.widget.TextView;
   import android.widget.Toast;
   import android.widget.ToggleButton;
   import android.widget.SimpleAdapter.ViewBinder;
 
   public class EntryPointActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main) ;
RadioGroup radioGroup = (RadioGroup)this.findViewById(R.id.rg) ;
radioGroup.setOnCheckedChangeListener( new OnCheckedChangeListener() {
 @Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// ... :(
}
});
}
   }
 
   Any kind of help is much more appreciated. Thanks
 
   --
 
  * Shamir Shakir*
   L-2, T-2, Grad. Student, B. Sc., Dept. of CSE,
   Military Institute of Science and Technology (MIST),
   Mirpur Cantonment, Dhaka, Bangladesh.
 
  www.dewsworld.info| dewswo...@gmail.com
 
--
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
  --
  Mark Murphy (a Commons Guy)http://commonsware.com|
 http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
 
  _The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
  Available!

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en