public void renderView() {
    mGiftTip.setVisibility(View.INVISIBLE);
    mIndicator.setVisibility(View.GONE);
    mRadioGroup.setVisibility(View.INVISIBLE);
    mTxtSend.setVisibility(View.INVISIBLE);
    mLoading.setVisibility(View.VISIBLE);

    //		SpecialGift[] specialGifts = (SpecialGift[])
    // MemoryDataCenter.getInstance().get(MemoryDataCenter.SPECIALGIFTS);

    //		if(GiftInfoManager.getInstance().initData()){
    mGiftTip.setVisibility(View.VISIBLE);
    mRadioGroup.setVisibility(View.VISIBLE);
    mTxtSend.setVisibility(View.VISIBLE);
    mLoading.setVisibility(View.INVISIBLE);

    mGroupNames = GiftInfoManager.getGroupNames();

    mAdapter = new GiftKeyBoardAdapter(mContext, mGroupNames, forChat);
    mViewPager.setAdapter(mAdapter);

    // 初始化
    int firstPageCount = ((GiftKeyBoardAdapter) mAdapter).getFirstPageCount();
    int secondPageCount = ((GiftKeyBoardAdapter) mAdapter).getSecondPageCount();
    if (!forChat) {
      if (firstPageCount + secondPageCount > 1) {
        mIndicator.setVisibility(View.VISIBLE);
        mIndicator.setCount(firstPageCount + secondPageCount);
        mIndicator.setCurrentItem(0);
      }
      mIndicatorForChat.setVisibility(View.GONE);
    } else {
      mIndicator.setVisibility(View.GONE);
      if (firstPageCount + secondPageCount > 1) {
        mIndicatorForChat.setVisibility(View.VISIBLE);
        mIndicatorForChat.setCount(firstPageCount + secondPageCount);
        mIndicatorForChat.setCurrentItem(0);
      }
    }

    if (mGroupNames.length >= 2) {
      mRadioGroup.setVisibility(View.VISIBLE);
      mRadioGroup.removeAllViews();
      rlp = new RadioGroup.LayoutParams(0, LayoutParams.MATCH_PARENT);
      rlp.weight = 1.0f;
      for (int i = 0; i < mGroupNames.length; i++) {
        RadioButton rb =
            (RadioButton)
                ((LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
                    .inflate(R.layout.view_item_radio_button, null);
        if (i == 0) {
          rb.setChecked(true);
        }
        rb.setId(i);
        rb.setText(mGroupNames[i]);
        mRadioGroup.addView(rb, rlp);
        rb.setOnClickListener(listener);
      }
      mRadioGroup.check(0);
    }
    //		}

    if (forChat) {
      mGiftTip.setVisibility(View.GONE);
      mMarginLayout.setVisibility(View.GONE);
      mBottomLayout.setVisibility(View.GONE);
    } else {
      initUserPageSendGift(0);
    }
  }
  private void addRadioButton(int answerRow, String[] answer) {

    rgp = (RadioGroup) findViewById(R.id.radioGroup);

    //        ((RadioButton) rgp.getChildAt(answer)).setChecked(true);

    for (int row = 0; row < 1; row++) {

      for (int i = 0; i < answerRow; i++) {
        RadioButton radioButton = new RadioButton(this);
        radioButton.setText(answer[i]);
        radioButton.setId(i);
        //
        // radioButton.setBackground(getDrawable(R.drawable.custom_radiogroup_divider));
        radioButton.invalidate();
        RadioGroup.LayoutParams rprms =
            new RadioGroup.LayoutParams(
                RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);

        //                rprms.topMargin = 20 ;
        rprms.weight = 1f;
        rprms.leftMargin = 60;
        //                rprms.gravity = Gravity.CENTER | Gravity.LEFT;
        rgp.addView(radioButton, rprms);
      }
    }

    rgp.setOnCheckedChangeListener(
        new RadioGroup.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {

            // get selected radio button from radioGroup
            int selectedId = rgp.getCheckedRadioButtonId();

            RadioButton radioButton = (RadioButton) findViewById(checkedId);

            radioButton.setChecked(true);

            String selection = (String) radioButton.getText();

            txtStudentAnswer.setText(selection);

            if (counter == 0) {

              QuestionID = getQuestionID(Question);
            } else {

              //                    int Question_id = sp.getInt("Question_ID " + counter, -1);
            }

            editor.putInt("answer_choice " + counter, checkedId);
            editor.putString("answer_choice" + counter, selection);
            editor.putString("specificAnswer" + counter, specificAnswer);
            editor.putInt("answer_choice_ID" + counter, getChoiceID(selection, QuestionID));
            editor.commit();

            // find the radiobutton by returned id
            //                Toast.makeText(QuestionPageActivity.this, radioButton
            //                        .getText(), Toast.LENGTH_SHORT).show();
            //
            //                Log.d("GExam", "Question: " + (counter + 1) + " = " +
            // String.valueOf(sp.getInt("answer_choice " + (counter), -1)));
            //
            //
            //
            //
            //
            //
            //
            //                Log.e("GExam", "score = " + score);
            //                Log.e("GExam", "selection = " + selection);
            Log.e("GExam", "QuestionID = " + QuestionID);
          }
        });
  } //  end of addRadioButton