-3

Im working in a app that the main layout is made of two RadioGroups in different colums, and one button. The user of the app have to choose one option of each RadioGroup, and when he/she clicks the button, i need to open respective layout with the image inside.

For example, we have RadioGroup1 made of A, B, C, D. And we have RadioGroup2 made of 1, 2, 3, 4. When i click the Button i need to open the image that he/she selected (A1, A2, B1, B2, C4, D4, etc..)

Can you guide me a little bit to know where to start looking? some link or some

Thanks for your time !

George Mulligan
  • 11,813
  • 6
  • 37
  • 50
  • 1
    Sigh at least read the guide of how to ask questions here... anyways if by image you mean image view you can try some guides about how to make them and append them to your view and sort some function that detects if both radio groups have at least 1 button pressed and if they do append an image view to your activity. – ivan Jan 27 '16 at 21:08
  • Im sorry about the not reading guide of questions, its my first time here. Let me clear out something, when i said image, i mean layout, because the image is inside of a layout, so all i need is that the button opens the layout of the radiogroups selections combinated. maybe something like if/else codes? Thanks for your time, i really appreciate, and about the instant answer :D thanks – Juan Ignacio De Luca Jan 27 '16 at 22:01

1 Answers1

0

i really appreciate your time to reed and answer, thank you.

After a few hours reading and surfing the web and so, i figured out, and it works!! i paste the code, for you to see the answer just in case someone is interested on it

it was pretty easy i guess, here it goes the MainActivity=

    rg1=(RadioGroup)findViewById(R.id.radioGroup1);
    rg2=(RadioGroup)findViewById(R.id.radioGroup2);
    btn=(Button)findViewById(R.id.button);

    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(rg1.getCheckedRadioButtonId()==R.id.m1){
                if(rg2.getCheckedRadioButtonId()==R.id.sb) {
                    startActivity(new Intent(MainActivity.this, Main2Activity.class));
                }else if(rg1.getCheckedRadioButtonId())

and repeat this last step for each combination possible, M1 and SB are ID's of radiobuttons

Thanks for make me open my mind, i really appreciate your time

Good luck, take care

See you!