title: How to get the String value inside my onclick function in android?
body: <pre><code>   final RadioGroup radioGroup1 = (RadioGroup) findViewById(R.id.radiogroup);
                final TextView tv=(TextView) findViewById(R.id.textView1);   
          Button  mSubmitButton = (Button) findViewById(R.id.btnSubmit);
          relation.setOnItemSelectedListener(new CustomOnItemSelectedListener());
          radioGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
          String text1;
              @Override
              public void onCheckedChanged(RadioGroup group, int checkedId) 
              {
                  RadioButton checkedRadioButton = (RadioButton) findViewById(checkedId);
                 text1 = checkedRadioButton.getText().toString();
  
                  Toast.makeText(getApplicationContext(), text1, Toast.LENGTH_SHORT).show();
  
              }
          });
  
  
          mSubmitButton.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                   String fName = first_name.getText().toString();
                   String re_lation = (String) relation.getSelectedItem(); 
                   String add_ress = address.getText().toString();
                    }
  </code></pre>
  
  <p>Here inside my Onclick function,i wanna to get the text1 value from onCheckedChanged.how to get the text1 value inside my onclick function?</p>