Code example for RadioButton

Methods: setEnabledsetTextColor, setBackgroundColor, setChecked

0
     	super.doGettingItemViews(index, fontSize, bShowRefAnswer);
     	doLayoutSubViews(); 
     	 
     	mRadioButtonA.setEnabled(false);
     	mRadioButtonB.setEnabled(false);
     	mRadioButtonC.setEnabled(false);
     	mRadioButtonD.setEnabled(false);
     	 
     	AnswerManager answerMgr = mHostActivity.getAnswerManager();
     	Answer answer = answerMgr.getAnswer(mQuestionMgr.getIdByIndex(index));
     	if (answer != null){
	    	Parcel parcelValues  = answer.getAnswer(); 
	    	if (parcelValues != null){
	        	boolean[] bValue = parcelValues.createBooleanArray();
	        	assert bValue.length == 4;
	        	mRadioButtonA.setChecked(bValue[0]);
	        	mRadioButtonB.setChecked(bValue[1]);
	        	mRadioButtonC.setChecked(bValue[2]);       	
	        	mRadioButtonD.setChecked(bValue[3]);
	    	} 
		} 
     	 
     	if (!bShowRefAnswer){
     		return; 
     	} 
    	int colorNormal = Color.rgb(0, 0, 0); 
    	int colorBackground = Color.rgb(232, 232, 232);
    	 
    	setRadioButtonInfo(mRadioButtonA, colorNormal, colorBackground);
    	setRadioButtonInfo(mRadioButtonB, colorNormal, colorBackground);
    	setRadioButtonInfo(mRadioButtonC, colorNormal, colorBackground);
    	setRadioButtonInfo(mRadioButtonD, colorNormal, colorBackground);
   		 
    	if (answer!= null && !answer.isCorrect()){
    		Parcel parcelValues = answer.getRefAnswer();
        	if (parcelValues != null){
	        	boolean[] bValue = parcelValues.createBooleanArray();
	        	assert bValue.length == 4;
	     
	        	int RectifyFontColor = Color.rgb(248, 254, 131);	 
	        	int RectifyBackground = Color.rgb(0, 128, 0);
	        	if (bValue[0]) {
	            	setRadioButtonInfo(mRadioButtonA, RectifyFontColor, RectifyBackground);	        	
	            } 
	           	if (bValue[1]) {
	           		setRadioButtonInfo(mRadioButtonB, RectifyFontColor, RectifyBackground);	           		
	           	} 
	           	if (bValue[2]) {
	           		setRadioButtonInfo(mRadioButtonC, RectifyFontColor, RectifyBackground);	           		
	           	} 
	           	if (bValue[3]) {
	           		setRadioButtonInfo(mRadioButtonD, RectifyFontColor, RectifyBackground);	           		
	           	} 
        	} 
    	} 
    }	 
 
	private void setRadioButtonInfo(RadioButton btn, Integer index, PanelClickListener listener){
		btn.setTag(index);
		btn.setOnClickListener(listener);
	} 
	 
	private void setRadioButtonInfo(RadioButton btn, int fontColor, int bgColor){
		btn.setTextColor(fontColor);
		btn.setBackgroundColor(bgColor);		
	} 
 
	private void doLayoutSubViews(){ 
    	if (mLinearLayoutOptions != null){ 
    		mLinearLayoutOptions.setVisibility(View.VISIBLE);