To provide animation to each radio button in a radioburron group in android.
Here I am creating RadioGroup Dynamicaly
int numAnswer=5;
RadioGroup radioGroupd=new RadioGroup(getApplicationContext());
int numAnswer=Integer.valueOf(questions.get(showedNum).questions_answers_count);
for(int i=0;i<numAnswer;i++)
{
button=new RadioButton(getApplicationContext());
button.setTextColor(Color.GREEN);
button.setId(i);
button.setTextSize(subtextSize);
button.setText(questions.get(showedNum).answer_list[i]);
radioGroupd.addView(button);
}
//imp
radioGroupd.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
/
int id= group.getCheckedRadioButtonId();//get id
RadioButton b = (RadioButton) findViewById(id);
b.startAnimation(myanimateItems);
}
});
Here I am creating RadioGroup Dynamicaly
int numAnswer=5;
RadioGroup radioGroupd=new RadioGroup(getApplicationContext());
int numAnswer=Integer.valueOf(questions.get(showedNum).questions_answers_count);
for(int i=0;i<numAnswer;i++)
{
button=new RadioButton(getApplicationContext());
button.setTextColor(Color.GREEN);
button.setId(i);
button.setTextSize(subtextSize);
button.setText(questions.get(showedNum).answer_list[i]);
radioGroupd.addView(button);
}
//imp
radioGroupd.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
/
int id= group.getCheckedRadioButtonId();//get id
RadioButton b = (RadioButton) findViewById(id);
b.startAnimation(myanimateItems);
}
});