Look at this:
total = rg1.getCheckedRadioButtonId() + rg2.getCheckedRadioButtonId();
you are trying to add RadioButtonId's which are radio1, radio2, etc.
There are likely many ways to do this but I think I would create a sum variable that adds the chosen number to it.
case R.id.radio5:
if (r5.isChecked()){
//a1=1;
sum += 1;
}
and finally
tv1.setText("result: "+ sum);
you would need to reset sum each time so it doesn't keep adding to previous.