how to set and get the value of gender radio button in android studio?

Joe

Hi guys please help me.. please check my codes and add possible solution..

I have radiogroup name radioGender and radio button name radioMale and radioFemale.

My question is how to set the value of radioMale to m and radioFemale to f then assign the value to customers_gender so that I can save the value in the database?

registerlayout.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:fillViewport="false">
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent" android:layout_height="match_parent"
        >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageView4"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:src="@drawable/logo"
            android:maxHeight="54dp"
            android:maxWidth="322dp"
            android:layout_marginTop="20dp"
            android:layout_marginLeft="100dp"
            android:layout_marginRight="100dp" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageView5"
            android:layout_below="@+id/imageView4"
            android:layout_centerHorizontal="true"
            android:src="@drawable/lock"
            android:layout_marginLeft="150dp"
            android:layout_marginRight="150dp"
            android:layout_marginTop="-60dp" />

        <RadioGroup
            android:id="@+id/radioGender"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/imageView5"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:layout_marginTop="-30dp"
            android:orientation="horizontal">

            <RadioButton
                android:id="@+id/radioMale"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="true"
                android:text="Mr."
                android:layout_gravity="center_vertical"
                android:textColor="#ff6d6e71" />

            <RadioButton
                android:id="@+id/radioFemale"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="false"
                android:textSize="14dp"
                android:text="Ms."
                android:textColor="#ff6d6e71" />

        </RadioGroup>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtFname"
            android:layout_below="@+id/radioSex"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:hint="First Name"
            android:background="#ffeeeeee"
            android:padding="10dp"
            android:layout_marginTop="10dp"
            android:textColor="#ff6d6e71" />

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtLname"
            android:layout_below="@+id/txtFname"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:hint="Last Name"
            android:background="#ffeeeeee"
            android:padding="10dp"
            android:textColor="#ff6d6e71"
            android:layout_marginTop="10dp" />

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/txtEmail"
            android:layout_below="@+id/txtLname"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:hint="Email Address"
            android:background="#ffeeeeee"
            android:padding="10dp"
            android:textColor="#ff6d6e71"
            android:layout_marginTop="10dp" />

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:ems="10"
            android:id="@+id/txtPassword"
            android:layout_below="@+id/txtEmail"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="10dp"
            android:layout_marginRight="30dp"
            android:textColor="#ff6d6e71"
            android:background="#ffeeeeee"
            android:padding="10dp"
            android:hint="Password" />

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:ems="10"
            android:id="@+id/txtPasswordrepeat"
            android:layout_below="@+id/txtPassword"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="10dp"
            android:layout_marginRight="30dp"
            android:textColor="#ff6d6e71"
            android:background="#ffeeeeee"
            android:padding="10dp"
            android:hint="Confirm Password" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Sign Up"
            android:id="@+id/btnSignup"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:textColor="#ff6d6e71"
            android:layout_marginTop="10dp"
            android:layout_below="@+id/txtPasswordrepeat"
            android:longClickable="false"
            android:clickable="true"
            android:background="#fffed4d4" />




    </RelativeLayout>
</ScrollView>

RegisterFragment.java

        public class RegisterFragment extends Fragment implements View.OnClickListener{

    public RegisterFragment(){}
    public String customers_gender="m";

    Button btnSignup;
    EditText txtFname, txtLname, txtEmail, txtPassword, txtPasswordrepeat;
    RadioGroup radioGender;

    UserLocalStore userLocalStore;

    String Expn =
            "^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@"
                    +"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
                    +"[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
                    +"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
                    +"[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
                    +"([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$";

    Boolean InternetAvailable = false;
    Seocnd detectconnection;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
        View rootView = inflater.inflate(R.layout.registerlayout, container, false);

        radioGender=(RadioGroup) rootView.findViewById(R.id.radioGender);
        radioGender.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                int childCount = group.getChildCount();
                for (int x = 0; x < childCount; x++) {
                    RadioButton btn = (RadioButton) group.getChildAt(x);


                    if(btn.getId()==R.id.radioMale){
                        btn.setText("m");
                    }else{
                        btn.setText("f");
                    }
                    if (btn.getId() == checkedId) {

                        customers_gender=btn.getText().toString();// here gender will contain M or F.

                    }

                }

                Log.e("Gender", customers_gender);
            }
        });

        txtFname = (EditText) rootView.findViewById(R.id.txtFname);
        txtLname = (EditText) rootView.findViewById(R.id.txtLname);
        txtEmail = (EditText) rootView.findViewById(R.id.txtEmail);
        txtPassword = (EditText) rootView.findViewById(R.id.txtPassword);
        txtPasswordrepeat = (EditText) rootView.findViewById(R.id.txtPasswordrepeat);
        btnSignup = (Button) rootView.findViewById(R.id.btnSignup);
        btnSignup.setOnClickListener(this);

        userLocalStore = new UserLocalStore(getActivity());

        detectconnection = new Seocnd(getActivity());
        InternetAvailable = detectconnection.InternetConnecting();
        if (InternetAvailable) {
        } else {
            NointernetFragment fragment = new NointernetFragment();
            FragmentManager fragmentManager = getFragmentManager();
            fragmentManager.beginTransaction()
                    .replace(R.id.container, fragment)
                    .commit();
        }

        return rootView;
    }

    @Override
    public void onClick(View v){
        switch(v.getId()){
            case R.id.btnSignup:
                //String customers_gender = txtGender.getText().toString();
                String customers_firstname = txtFname.getText().toString();
                String customers_lastname = txtLname.getText().toString();
                String customers_email_address = txtEmail.getText().toString();
                String customers_password = txtPassword.getText().toString();
                String customers_passwordrepeat = txtPasswordrepeat.getText().toString();

                if(customers_firstname.length()==0){
                    txtFname.setError("First Name is required.");
                }
                else if(customers_lastname.length()==0){
                    txtLname.setError("Last Name is required.");
                }
                else if(customers_email_address.length()==0){
                    txtEmail.setError("Email Address is required.");
                }
                else if(customers_email_address.length()<=4){
                    txtEmail.setError("Email Address must be at least 5 characters long.");
                }
                else if(customers_email_address.matches(Expn)){
                    if(customers_password.length()==0){
                        txtPassword.setError("Password is required.");
                    }
                    else if(customers_password.length()<=6){
                        txtPassword.setError("Your Password must contain a minimum of 7 characters!");
                    }
                    else if(customers_passwordrepeat.length()==0){
                        txtPasswordrepeat.setError("Confirm Password is required.");
                    }
                    else if (!customers_passwordrepeat.equals(customers_password)) {
                        txtPasswordrepeat.setError("The Password Confirmation must match your password!");
                    }else {
                        User user = new User(customers_gender, customers_firstname, customers_lastname, customers_email_address, customers_password);
                        registeredUser(user);
                    }
                }else{
                    txtEmail.setError("Email Address is not valid.");
                }
                break;
        }
    }

    public void registeredUser(User user){
        ServerRequests serverRequests = new ServerRequests(getActivity());
        serverRequests.storeUserDataInBackground(user, new GetUSerCallBack(){
            @Override
            public void done(User returnedUser){
                AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
                dialogBuilder.setMessage("Your Account Has Been Created!");
                dialogBuilder.setPositiveButton("Ok",null);
                dialogBuilder.show();

                LoginFragment fragment = new LoginFragment();
                FragmentManager fragmentManager = getFragmentManager();
                fragmentManager.beginTransaction()
                        .replace(R.id.container, fragment)
                        .commit();
            }
        });
    }
}

heres the error

09-11 18:57:57.409    1023-1023/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
09-11 18:57:57.409    1023-1023/? D/AndroidRuntime﹕ CheckJNI is ON
09-11 18:57:58.110    1023-1023/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am
09-11 18:57:58.119       78-439/? I/ActivityManager﹕ Force stopping package com.example.administrator.mosbeau uid=10040
09-11 18:57:58.130    1023-1023/? D/AndroidRuntime﹕ Shutting down VM
09-11 18:57:58.165    1023-1027/? D/dalvikvm﹕ GC_CONCURRENT freed 95K, 79% free 447K/2048K, paused 1ms+1ms
09-11 18:57:58.165    1023-1033/? I/AndroidRuntime﹕ NOTE: attach of thread 'Binder Thread #3' failed
09-11 18:57:58.609    1036-1036/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
09-11 18:57:58.609    1036-1036/? D/AndroidRuntime﹕ CheckJNI is ON
09-11 18:57:59.059    1036-1036/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am
09-11 18:57:59.079       78-191/? I/ActivityManager﹕ START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.administrator.mosbeau/.MainActivity} from pid 1036
09-11 18:57:59.089       78-191/? W/WindowManager﹕ Failure taking screenshot for (240x394) to layer 21005
09-11 18:57:59.112    1036-1036/? D/AndroidRuntime﹕ Shutting down VM
09-11 18:57:59.120    1036-1040/? D/dalvikvm﹕ GC_CONCURRENT freed 98K, 77% free 480K/2048K, paused 1ms+1ms
09-11 18:57:59.130    1036-1046/? I/AndroidRuntime﹕ NOTE: attach of thread 'Binder Thread #3' failed
09-11 18:57:59.190    1047-1047/? D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
09-11 18:57:59.220       78-440/? I/ActivityManager﹕ Start proc com.example.administrator.mosbeau for activity com.example.administrator.mosbeau/.MainActivity: pid=1047 uid=10040 gids={3003}
09-11 18:57:59.500        78-93/? W/ProcessStats﹕ Skipping unknown process pid 1034
09-11 18:57:59.500        78-93/? W/ProcessStats﹕ Skipping unknown process pid 1036
09-11 18:57:59.520       78-116/? W/NetworkManagementSocketTagger﹕ setKernelCountSet(10040, 1) failed with errno -2
09-11 18:57:59.909        78-92/? I/Process﹕ Sending signal. PID: 1047 SIG: 3
09-11 18:57:59.909    1047-1052/? I/dalvikvm﹕ threadid=3: reacting to signal 3
09-11 18:57:59.989    1047-1052/? I/dalvikvm﹕ Wrote stack traces to '/data/anr/traces.txt'
09-11 18:58:00.233        78-81/? D/dalvikvm﹕ GC_CONCURRENT freed 480K, 16% free 15000K/17799K, paused 6ms+18ms
09-11 18:58:00.359    1047-1047/? I/dalvikvm﹕ Could not find method android.view.ViewGroup.onWindowSystemUiVisibilityChanged, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onWindowSystemUiVisibilityChanged
09-11 18:58:00.359    1047-1047/? W/dalvikvm﹕ VFY: unable to resolve virtual method 13365: Landroid/view/ViewGroup;.onWindowSystemUiVisibilityChanged (I)V
09-11 18:58:00.359    1047-1047/? D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0008
09-11 18:58:00.409        78-92/? I/Process﹕ Sending signal. PID: 1047 SIG: 3
09-11 18:58:00.409    1047-1052/? I/dalvikvm﹕ threadid=3: reacting to signal 3
09-11 18:58:00.429    1047-1052/? I/dalvikvm﹕ Wrote stack traces to '/data/anr/traces.txt'
09-11 18:58:00.440    1047-1047/? I/dalvikvm﹕ Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
09-11 18:58:00.440    1047-1047/? W/dalvikvm﹕ VFY: unable to resolve virtual method 13361: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
09-11 18:58:00.440    1047-1047/? D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0007
09-11 18:58:00.460    1047-1047/? I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
09-11 18:58:00.460    1047-1047/? W/dalvikvm﹕ VFY: unable to resolve virtual method 432: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
09-11 18:58:00.460    1047-1047/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
09-11 18:58:00.460    1047-1047/? I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
09-11 18:58:00.460    1047-1047/? W/dalvikvm﹕ VFY: unable to resolve virtual method 454: Landroid/content/res/TypedArray;.getType (I)I
09-11 18:58:00.460    1047-1047/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
09-11 18:58:00.600    1047-1049/? D/dalvikvm﹕ GC_CONCURRENT freed 225K, 3% free 12841K/13127K, paused 5ms+4ms
09-11 18:58:00.670    1047-1047/? D/dalvikvm﹕ GC_FOR_ALLOC freed 71K, 3% free 12822K/13127K, paused 27ms
09-11 18:58:00.670    1047-1047/? I/dalvikvm-heap﹕ Grow heap (frag case) to 13.302MB for 757776-byte allocation
09-11 18:58:00.750    1047-1049/? D/dalvikvm﹕ GC_CONCURRENT freed 1K, 3% free 13561K/13895K, paused 4ms+3ms
09-11 18:58:00.800    1047-1047/? D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 3% free 13561K/13895K, paused 24ms
09-11 18:58:00.820    1047-1047/? I/dalvikvm-heap﹕ Grow heap (frag case) to 16.192MB for 3031056-byte allocation
09-11 18:58:00.860    1047-1049/? D/dalvikvm﹕ GC_CONCURRENT freed 0K, 3% free 16521K/16903K, paused 4ms+3ms
09-11 18:58:00.910        78-92/? I/Process﹕ Sending signal. PID: 1047 SIG: 3
09-11 18:58:00.910    1047-1052/? I/dalvikvm﹕ threadid=3: reacting to signal 3
09-11 18:58:00.920    1047-1052/? I/dalvikvm﹕ Wrote stack traces to '/data/anr/traces.txt'
09-11 18:58:01.020    1047-1047/? D/dalvikvm﹕ GC_FOR_ALLOC freed 740K, 7% free 16250K/17415K, paused 28ms
09-11 18:58:01.030    1047-1047/? I/dalvikvm-heap﹕ Grow heap (frag case) to 17.753MB for 1914896-byte allocation
09-11 18:58:01.080    1047-1049/? D/dalvikvm﹕ GC_CONCURRENT freed <1K, 7% free 18120K/19335K, paused 5ms+4ms
09-11 18:58:01.150    1047-1047/? D/dalvikvm﹕ GC_FOR_ALLOC freed 467K, 9% free 17654K/19335K, paused 26ms
09-11 18:58:01.160    1047-1047/? I/dalvikvm-heap﹕ Grow heap (frag case) to 18.031MB for 768016-byte allocation
09-11 18:58:01.200    1047-1047/? D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 9% free 18403K/20103K, paused 29ms
09-11 18:58:01.230    1047-1047/? D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 9% free 18404K/20103K, paused 30ms
09-11 18:58:01.249    1047-1047/? I/dalvikvm-heap﹕ Grow heap (frag case) to 20.960MB for 3072016-byte allocation
09-11 18:58:01.299    1047-1049/? D/dalvikvm﹕ GC_CONCURRENT freed 0K, 8% free 21404K/23111K, paused 4ms+5ms
09-11 18:58:01.419        78-92/? I/Process﹕ Sending signal. PID: 1047 SIG: 3
09-11 18:58:01.419    1047-1052/? I/dalvikvm﹕ threadid=3: reacting to signal 3
09-11 18:58:01.419    1047-1052/? I/dalvikvm﹕ Wrote stack traces to '/data/anr/traces.txt'
09-11 18:58:01.479    1047-1047/? W/ActionBarDrawerToggleHoneycomb﹕ Couldn't set home-as-up indicator
09-11 18:58:01.539    1047-1047/? D/gralloc_goldfish﹕ Emulator without GPU emulation detected.
09-11 18:58:01.629       78-106/? I/ActivityManager﹕ Displayed com.example.administrator.mosbeau/.MainActivity: +2s473ms
09-11 18:58:01.670       78-116/? W/NetworkManagementSocketTagger﹕ setKernelCountSet(10021, 0) failed with errno -2
09-11 18:58:07.940    1047-1047/? I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawable
09-11 18:58:07.940    1047-1047/? W/dalvikvm﹕ VFY: unable to resolve virtual method 395: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
09-11 18:58:07.950    1047-1047/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
09-11 18:58:07.950    1047-1047/? I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawableForDensity
09-11 18:58:07.950    1047-1047/? W/dalvikvm﹕ VFY: unable to resolve virtual method 397: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
09-11 18:58:07.950    1047-1047/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
09-11 18:58:11.519    1047-1047/? E/Gender﹕ f
09-11 18:58:11.519    1047-1047/? D/AndroidRuntime﹕ Shutting down VM
09-11 18:58:11.519    1047-1047/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x409bf1f8)
09-11 18:58:11.539    1047-1047/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.IllegalStateException: Could not find a method selectGender(View) in the activity class com.example.administrator.mosbeau.MainActivity for onClick handler on view class android.support.v7.widget.AppCompatRadioButton with id 'radioFemale'
            at android.view.View$1.onClick(View.java:3031)
            at android.view.View.performClick(View.java:3511)
            at android.widget.CompoundButton.performClick(CompoundButton.java:100)
            at android.view.View$PerformClick.run(View.java:14105)
            at android.os.Handler.handleCallback(Handler.java:605)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4424)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NoSuchMethodException: selectGender [class android.view.View]
            at java.lang.Class.getConstructorOrMethod(Class.java:460)
            at java.lang.Class.getMethod(Class.java:915)
            at android.view.View$1.onClick(View.java:3024)
            at android.view.View.performClick(View.java:3511)
            at android.widget.CompoundButton.performClick(CompoundButton.java:100)
            at android.view.View$PerformClick.run(View.java:14105)
            at android.os.Handler.handleCallback(Handler.java:605)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4424)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)
09-11 18:58:11.559       78-440/? W/ActivityManager﹕ Force finishing activity com.example.administrator.mosbeau/.MainActivity
09-11 18:58:11.569       78-440/? W/WindowManager﹕ Failure taking screenshot for (240x394) to layer 21010
09-11 18:58:12.081        78-92/? W/ActivityManager﹕ Activity pause timeout for ActivityRecord{419c65b0 com.example.administrator.mosbeau/.MainActivity}
09-11 18:58:12.100        78-92/? I/Process﹕ Sending signal. PID: 1047 SIG: 3
09-11 18:58:12.100    1047-1052/? I/dalvikvm﹕ threadid=3: reacting to signal 3
09-11 18:58:12.120    1047-1052/? I/dalvikvm﹕ Wrote stack traces to '/data/anr/traces.txt'
09-11 18:58:12.150       78-116/? W/NetworkManagementSocketTagger﹕ setKernelCountSet(10021, 1) failed with errno -2
09-11 18:58:12.829       78-116/? W/NetworkManagementSocketTagger﹕ setKernelCountSet(10040, 0) failed with errno -2
09-11 18:58:14.059    1047-1047/? I/Process﹕ Sending signal. PID: 1047 SIG: 9
09-11 18:58:14.080       78-268/? I/ActivityManager﹕ Process com.example.administrator.mosbeau (pid 1047) has died.
09-11 18:58:14.080        78-89/? I/WindowManager﹕ WIN DEATH: Window{4195e7e0 com.example.administrator.mosbeau/com.example.administrator.mosbeau.MainActivity paused=false}
09-11 18:58:14.119       78-269/? W/InputManagerService﹕ Got RemoteException sending setActive(false) notification to pid 1047 uid 10040
Rustam

Implement setOnCheckedChangeListener for radioGender.

 radioGender=(RadioGroup)findViewById(R.id.radioGender);

 radioGender.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                // TODO Auto-generated method stub
                int childCount = group.getChildCount();
                String gender=null;
                for (int x = 0; x < childCount; x++) {
                    RadioButton btn = (RadioButton) group.getChildAt(x);


                    if(btn.getId()==R.id.radioMale){
                        btn.setText("M");
                    }else{
                        btn.setText("F");
                    }
                    if (btn.getId() == checkedId) {

                         gender=btn.getText().toString();// here gender will contain M or F.

                    }

                }

                Log.e("Gender",gender);
            }
        });

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to set value of a radio button inside a radio group android

From Dev

Set default radio button in Android Studio

From Dev

how to set a radio button value in protractor

From Dev

How to set a default radio button with a value?

From Java

Android: How to set text of radio button into an Integer?

From Dev

DOM javascript Form Gender Radio button "on" value output

From Java

How to get value of selected radio button?

From Dev

How do I get the value of the radio button?

From Dev

How to get value of selected radio button in angularjs

From Dev

How To get Selected Radio Button Value in Mvc

From Dev

How to get the value of the selected radio button?

From Dev

How to get radio button value in SweetAlert with AngularJS

From Dev

how to get checked radio button value in javascript

From Dev

How to get the value of a radio button in a table - PHP

From Dev

how get radio button value in javascript

From Dev

How to get the value of radio button in ColdFusion?

From Dev

How get value of selected radio button in datalist

From Dev

how to get all radio button value by name

From Dev

Get radio button value

From Dev

How can get the value of Radio Button Inside Listview Click on Button in Android

From Dev

Set default value in radio button

From Dev

Set the value of a nested radio button

From Dev

How to check radio button with radio button value

From Dev

Radio Button parse android studio

From Dev

How to call directive on radio button to set value in Angular Js

From Dev

How to set radio button selected value using jquery

From Dev

get Value DataPicker and Radio Button

From Dev

Android : how to get the gender and age of the user?

From Dev

How to always set default checked radio button programmatically android?

Related Related

  1. 1

    How to set value of a radio button inside a radio group android

  2. 2

    Set default radio button in Android Studio

  3. 3

    how to set a radio button value in protractor

  4. 4

    How to set a default radio button with a value?

  5. 5

    Android: How to set text of radio button into an Integer?

  6. 6

    DOM javascript Form Gender Radio button "on" value output

  7. 7

    How to get value of selected radio button?

  8. 8

    How do I get the value of the radio button?

  9. 9

    How to get value of selected radio button in angularjs

  10. 10

    How To get Selected Radio Button Value in Mvc

  11. 11

    How to get the value of the selected radio button?

  12. 12

    How to get radio button value in SweetAlert with AngularJS

  13. 13

    how to get checked radio button value in javascript

  14. 14

    How to get the value of a radio button in a table - PHP

  15. 15

    how get radio button value in javascript

  16. 16

    How to get the value of radio button in ColdFusion?

  17. 17

    How get value of selected radio button in datalist

  18. 18

    how to get all radio button value by name

  19. 19

    Get radio button value

  20. 20

    How can get the value of Radio Button Inside Listview Click on Button in Android

  21. 21

    Set default value in radio button

  22. 22

    Set the value of a nested radio button

  23. 23

    How to check radio button with radio button value

  24. 24

    Radio Button parse android studio

  25. 25

    How to call directive on radio button to set value in Angular Js

  26. 26

    How to set radio button selected value using jquery

  27. 27

    get Value DataPicker and Radio Button

  28. 28

    Android : how to get the gender and age of the user?

  29. 29

    How to always set default checked radio button programmatically android?

HotTag

Archive