package com.example.ryan.myapplication;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.RadioGroup;
public class MainActivity extends AppCompatActivity {
ImageView image;
RadioGroup group;
//
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image=(ImageView)findViewById(R.id.imageView
);
group=(RadioGroup)findViewById(R.id.radiogroup1);
}
//
//
public void onRadioButtonClicked(View view) {
//
switch (group.getCheckedRadioButtonId()) {
case R.id.button1:
image.setImageResource(R.drawable.cat);
break;
case R.id.button2:
image.setImageResource(R.drawable.dog1);
break;
case R.id.button3:
image.setImageResource(R.drawable.dog2);
break;
}///
}
///
}