Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7972191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:48:04+00:00 2026-06-04T07:48:04+00:00

I have a problem with the handle RadioGrup. The application gets the string from

  • 0

I have a problem with the handle RadioGrup. The application gets the string from the OCR, which is cut and thrown into the adapter on the list of listview with 4 RadioButtons and it is already running.
http://dl.dropbox.com/u/158361/screenshot-1336249818620.png

As shown in the screenshot are 4 EditText to which I return an item within a list according to which radiobuton was pressed.
How to send the string after selecting raiobutton?

My code:

public class ocrResults extends Activity implements OnClickListener {
public static final int CAPTURE_ACTIVITY_REQUEST_CODE = 1;
public ListaAdapterResults listaAdapterRes;
public ListView id_list_tokens;     
public String[] splittedArray;
String tag = "Events";

public EditText etNazwa;
public EditText etAdres;
public EditText etGodziny;
public EditText etTelefon;
public RadioGroup radioGroup;

private View.OnClickListener onSave=new View.OnClickListener() {
   public void onClick(View v) {
      RadioSelect rs = new RadioSelect();
      rs.setItem(etNazwa.getText().toString());
      rs.setItem(etAdres.getText().toString());
      rs.setItem(etGodziny.getText().toString());
      rs.setItem(etTelefon.getText().toString());

      radioGroup=(RadioGroup)findViewById(R.id.group);

      switch (radioGroup.getCheckedRadioButtonId()) {
       case R.id.rbName:
           rs.setType("rbName");
           //etNazwa.setText(splittedArray[pos]);
           break;
       case R.id.rbAdres:
           rs.setType("rbAdres");
           break;
       case R.id.rbGodziny:
           rs.setType("rbGodziny");
           break;
       case R.id.rbTelefon:
           rs.setType("rbTelefon");
           break;
      }
      etNazwa.setText("");
      etAdres.setText("");
      etGodziny.setText("");
      etTelefon.setText("");
      radioGroup.clearCheck();
      Log.d(tag," potwierdz");
  }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.ocrresultsactivity);
   setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

   id_list_tokens = (ListView)findViewById(R.id.id_list_tokens);
   etNazwa  =(EditText)findViewById(R.id.EtResNazwa);
   etAdres  =(EditText)findViewById(R.id.EtResAdres);
   etGodziny=(EditText)findViewById(R.id.EtResGodziny);
   etTelefon=(EditText)findViewById(R.id.EtResTelefon);

   View btn_Zatw1 = findViewById(R.id.btnZatw1);
    btn_Zatw1.setOnClickListener(onSave);//this
   View btn_OCRmake1 = findViewById(R.id.btnOCRmake1);
    btn_OCRmake1.setOnClickListener(this);
   View btn_backtomain1 = findViewById(R.id.btnbacktomain1);
    btn_backtomain1.setOnClickListener(this);
   }
   @Override
   public void onClick(View v) {
  switch (v.getId()){
     case R.id.btnOCRmake1:
        Intent myIntent = new Intent(ocrResults.this, CaptureActivity.class);
        startActivityForResult(myIntent, CAPTURE_ACTIVITY_REQUEST_CODE);
        break;
     case R.id.btnbacktomain1:
        startActivity(new Intent(ocrResults.this, and4ph.class));
        finish();
        break;
  }
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_OK) {
        if (CAPTURE_ACTIVITY_REQUEST_CODE == requestCode) {
            String response = data.getStringExtra(edu.sfsu.cs.orange.ocr.CaptureActivity.RESPONSE);
            insertResponse(response);
        }
   }
    }
    private void insertResponse(String response) {
    String strResult = response;
    splittedArray = strResult.split(" ");   //(strResult, ' ');
    Context context = getApplicationContext();

    initListViewResp();
    }
    void initListViewResp() {           //Inicjalizacja ListView
    listaAdapterRes = new ListaAdapterResults(this, splittedArray);
    id_list_tokens.setAdapter(listaAdapterRes);

    //      if (mbutton[0] == true) { 
    //      mbutton[0]=holder.rb_Name;
    //       } else {
    //             // Get the ViewHolder back to get fast access to the ImageView.
    //             holder = (ViewHolder) convertView.getTag();
    //             holder.dealImage.setBackgroundColor(Color.WHITE);
    //             dealImage = holder.dealImage;
    //         }


    id_list_tokens.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int pos, long id) {
          Toast.makeText(getApplicationContext(), splittedArray[pos], Toast.LENGTH_SHORT).show();
        }
    });
    //getCheckedRadioButtonId();
    updateListView();
}
private void updateListView() {
    listaAdapterRes.notifyDataSetChanged();
}    
    }

And my adapter:

public class ListaAdapterResults extends ArrayAdapter<String> {
    String tag = "Events";
    private Activity context;
    private String[] splittedArray;

    public ListaAdapterResults(Activity context, String[] splittedArray){
        super(context, R.layout.wiersz_tokenu, splittedArray);
        this.context        = context;
        this.splittedArray  = splittedArray;
    }
    public long getItemId(int position) {
        return position;
    }
    static class ViewHolder {
        private TextView     tv_Token;
        private RadioButton rb_Name;
        private RadioButton rb_Adres;
        private RadioButton rb_Godziny;
        private RadioButton rb_Telefon;
        private RadioGroup rgroup;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Log.d(tag," 3");
        View rowView = convertView;
        ViewHolder holder= null;
        RadioButton[] mbutton = null;

        if(rowView == null) {
          LayoutInflater inflator = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          rowView = inflator.inflate(R.layout.wiersz_tokenu, parent, false);
          holder = new ViewHolder();
          holder.rgroup     = (RadioGroup) rowView.findViewById(R.id.group);
          holder.tv_Token   = (TextView) rowView.findViewById(R.id.tvToken);

          holder.rb_Name    = (RadioButton)rowView.findViewById(R.id.rbName);
          holder.rb_Adres   = (RadioButton)rowView.findViewById(R.id.rbAdres);
          holder.rb_Godziny = (RadioButton)rowView.findViewById(R.id.rbGodziny);
          holder.rb_Telefon = (RadioButton)rowView.findViewById(R.id.rbTelefon);

          mbutton=new RadioButton[4];
            mbutton[0]=holder.rb_Name;
            mbutton[1]=holder.rb_Adres;
            mbutton[2]=holder.rb_Godziny;
            mbutton[3]=holder.rb_Telefon;

          for(int i=0;  i<4; i++) {
              mbutton[i]=new RadioButton(context);
              //mbutton[l].setText("test"+l);
              //holder.rgroup.addView(mbutton[i]);
          }

          holder.rgroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
               public void onCheckedChanged(RadioGroup mRadioGroup, int checkedId) {

                   for(int i=0; i<mRadioGroup.getChildCount(); i++) {

                       RadioButton rbtn = (RadioButton) mRadioGroup.getChildAt(i);
                       //int t=table.indexOfChild(table_row);   //System.out.println(t);

                       int t = mRadioGroup.getId();
                       System.out.println(t);

                       if(rbtn.getId() == checkedId) {
                           String text = rbtn.getText().toString();
                           // do something with text
                           //etNazwa.setText(text);

                           RadioSelect rs = new RadioSelect();
//                        rs.setItem(etNazwa.getText().toString());
//                        rs.setItem(etAdres.getText().toString());
//                        rs.setItem(etGodziny.getText().toString());
//                        rs.setItem(etTelefon.getText().toString());
//                        mRadioGroup=(RadioGroup)findViewById(R.id.radioGroupTypET);

                          switch (mRadioGroup.getCheckedRadioButtonId()) {
                           case R.id.rbName:
                               rs.setType("rbName");
                                     //String text = rbtn.getText().toString();
                                     //etNazwa.setText(text);
                               break;
                           case R.id.rbAdres:
                               rs.setType("rbAdres");
                               break;
                           case R.id.rbGodziny:
                               rs.setType("rbGodziny");
                               break;
                           case R.id.rbTelefon:
                               rs.setType("rbTelefon");
                               break;
                          }
                          Log.d(text," radioButtonSelect");
                          return;
                        }
                    }
                }
          });
          rowView.setTag(holder);
          Log.d(tag,"me");
       } else {
          holder = (ViewHolder) convertView.getTag();
//        mbutton = holder.rgroup;
          Log.d(tag,"meeee");
       }
       ViewHolder holder1 = (ViewHolder) rowView.getTag();
       holder1.tv_Token.setText(splittedArray[position]);
       Log.d(tag," event7");

       holder.tv_Token.setText(splittedArray[position]);
       holder.rb_Name.setTag(new Integer(position));
       holder.rb_Adres.setTag(new Integer(position));
       holder.rb_Godziny.setTag(new Integer(position));
       holder.rb_Telefon.setTag(new Integer(position));
//      public void onCheckedChanged(RadioGroup rgroup,int checkedId){  }
      return rowView;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:48:06+00:00Added an answer on June 4, 2026 at 7:48 am

    In your getView method in holder.rgroup.setOnCheckedChangeListener set value for editText.
    e.g.

      String text = rbtn.getText().toString();
         etNazwa.setText(text);
    

    It looks that you have this code commented but with wrong parameter. You have etNazwa.setText(response); and it should be etNazwa.setText(text);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with a script and I don't know how to handle
I'm trying to get a handle on whether we have a problem in our
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have this problem that I probably understand but don't know how to handle,
I have a problem in an iPhone application. Application has a table view controller
I have problem with sortable <TD> 's. $(table tbody).sortable({ handle: td[tyhi='0'], cancel: td[tyhi='1'] });
I have a problem with request POST/GET in Android. I am trying to handle
I have following problem: My webservice application returns xml data in following order: <my_claims>
I have a problem with semaphores in Windows between two application. An application waits
I have one problem with publish/handle messages between 2 screens. My scenario is: Messenger

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.