package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.R;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class SelectOneWriteOtherQuestionFragment extends
        SelectOneQuestionFragment {

    @Override
    protected void beforeAddViewHook(ViewGroup questionComponent) {
        RadioButton radioButton = new RadioButton(getActivity());
        final EditText otherText = new EditText(getActivity());
        
        radioButton.setText(R.string.other_specify);
        radioButton.setTypeface(getInstrument().getTypeFace(getActivity().getApplicationContext()));
        final int otherId = getQuestion().options().size();
        radioButton.setId(otherId);
        getRadioGroup().setOnCheckedChangeListener(new OnCheckedChangeListener() {
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                otherText.setEnabled(checkedId == otherId);
                getResponse().setResponse(checkedId+"");
                getResponse().save();
            }
        });
        getRadioGroup().addView(radioButton, otherId);
        addOtherResponseView(otherText);
        questionComponent.addView(otherText);
    }
}

package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.R;

import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class SelectOneWriteOtherQuestionFragment extends
        SelectOneQuestionFragment {

    @Override
    protected void beforeAddViewHook(ViewGroup questionComponent) {
        RadioButton radioButton = new RadioButton(getActivity());
        final EditText otherText = new EditText(getActivity());
        
        radioButton.setText(R.string.other_specify);
        radioButton.setTypeface(getInstrument().getTypeFace(getActivity().getApplicationContext()));
        final int otherId = getQuestion().options().size();
        radioButton.setId(otherId);
        radioButton.setLayoutParams(new RadioGroup.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));
        getRadioGroup().setOnCheckedChangeListener(new OnCheckedChangeListener() {
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                otherText.setEnabled(checkedId == otherId);
                getResponse().setResponse(checkedId+"");
                getResponse().save();
            }
        });
        getRadioGroup().addView(radioButton, otherId);
        addOtherResponseView(otherText);
        questionComponent.addView(otherText);
    }
}

Fix other radio button width for right aligned languages