@Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_messages_menu);
   RadioButton rb1 = (RadioButton) findViewById(R.id.radioButton);
   RadioButton rb2 = (RadioButton) findViewById(R.id.radioButton2);
   RadioButton rb3 = (RadioButton) findViewById(R.id.radioButton3);
   Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/arvobold.ttf");
   rb1.setTypeface(typeFace);
   rb2.setTypeface(typeFace);
   rb3.setTypeface(typeFace);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_sort);

    this.setTitleColor(Color.parseColor("#EFc76508"));

    btn_done = (Button) findViewById(R.id.sort_done);
    btn_cancel = (Button) findViewById(R.id.sort_cancel);
    btn_toggle = (ToggleButton) findViewById(R.id.btn_up_or_down);
    radioGroup = (RadioGroup) findViewById(R.id.group_sort);
    sort_by_name = (RadioButton) findViewById(R.id.sort_by_name);
    sort_by_pri = (RadioButton) findViewById(R.id.sort_by_priority);
    sort_by_total = (RadioButton) findViewById(R.id.sort_by_total);
    sort_by_done = (RadioButton) findViewById(R.id.sort_by_donedate);
    sort_by_status = (RadioButton) findViewById(R.id.sort_by_status);
    btn_toggle.setSelected(false);

    sort_by_done.setTypeface(MyTypeFace_Roboto.Roboto_Regular(getApplicationContext()));
    sort_by_name.setTypeface(MyTypeFace_Roboto.Roboto_Regular(getApplicationContext()));
    sort_by_pri.setTypeface(MyTypeFace_Roboto.Roboto_Regular(getApplicationContext()));
    sort_by_total.setTypeface(MyTypeFace_Roboto.Roboto_Regular(getApplicationContext()));
    sort_by_status.setTypeface(MyTypeFace_Roboto.Roboto_Regular(getApplicationContext()));

    btn_done.setTypeface(MyTypeFace_Roboto.Roboto_Thin(getApplicationContext()));
    btn_cancel.setTypeface(MyTypeFace_Roboto.Roboto_Thin(getApplicationContext()));
    intent = this.getIntent();
    Bundle bundle = intent.getExtras();
    posSelected = bundle.getInt(MainActivity.POSITION_SORTED);
    Log.d("POSITION SELECTED", posSelected + "");
    switch (posSelected) {
      case 0:
        sort_by_name.setChecked(true);
        break;
      case 1:
        sort_by_pri.setChecked(true);
        break;
      case 2:
        sort_by_total.setChecked(true);
        break;
      case 3:
        sort_by_done.setChecked(true);
      case 4:
        sort_by_status.setChecked(true);
        break;

      default:
        sort_by_name.setChecked(true);
        break;
    }

    OnClickListener cancelListener =
        new OnClickListener() {
          public void onClick(View v) {
            setResult(RESULT_CANCELED, intent);
            finish();
          }
        };
    btn_cancel.setOnClickListener(cancelListener);

    OnClickListener toggleListener =
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (sort.equals(ASC)) {
              sort = DESC;
            } else sort = ASC;
          }
        };
    btn_toggle.setOnClickListener(toggleListener);

    OnClickListener doneListener =
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            int radioId = radioGroup.getCheckedRadioButtonId();
            if (radioId == sort_by_name.getId()) {
              orderBy = ShoppingDatabase.NAME + sort;
              posSelected = 0;
            } else if (radioId == sort_by_pri.getId()) {
              orderBy = ShoppingDatabase.PRIO + sort;
              posSelected = 1;
            } else if (radioId == sort_by_total.getId()) {
              orderBy = ShoppingDatabase.PRICE + "*" + ShoppingDatabase.QUANT + sort;
              posSelected = 2;
            } else if (radioId == sort_by_done.getId()) {
              orderBy = ShoppingDatabase.DONE_DATE + sort;
              posSelected = 3;
            } else if (radioId == sort_by_status.getId()) {
              orderBy = ShoppingDatabase.STATUS + sort;
              posSelected = 4;
            }
            intent.putExtra(MainActivity.REQUEST_ORDEYBY, orderBy);
            intent.putExtra(MainActivity.POSITION_SORTED, posSelected);
            setResult(RESULT_OK, intent);
            finish();
          }
        };
    btn_done.setOnClickListener(doneListener);
  }
  private void init() {

    databaseHelper = new DatabaseHelper(thisActivity);
    txt_village_name = (TextView) findViewById(R.id.txt_village_name);
    txt_lbl_village = (TextView) findViewById(R.id.txt_lbl_village);
    txt_add_street = (TextView) findViewById(R.id.txt_add_street);
    Utils.findAllTextView(thisActivity, (ViewGroup) findViewById(R.id.ll_add_family));
    lbl_family_number = (TextView) findViewById(R.id.lbl_family_number);
    lbl_yes = (TextView) findViewById(R.id.lbl_yes);
    lbl_no = (TextView) findViewById(R.id.lbl_no);
    lbl_bpl = (TextView) findViewById(R.id.lbl_bpl);
    txt_take_image = (TextView) findViewById(R.id.txt_take_image);
    lbl_family_dharm = (TextView) findViewById(R.id.lbl_family_dharm);
    lbl_family_cast = (TextView) findViewById(R.id.lbl_family_cast);
    lbl_house_number = (TextView) findViewById(R.id.lbl_house_number);
    txt_add_location = (TextView) findViewById(R.id.txt_add_location);
    ed_family_number = (EditText) findViewById(R.id.ed_family_number);
    ed_family_head_name = (EditText) findViewById(R.id.ed_family_head_name);
    ed_husband_name = (EditText) findViewById(R.id.ed_husband_name);
    ed_Sir_Name = (EditText) findViewById(R.id.ed_Sir_Name);
    ed_landmark = (EditText) findViewById(R.id.ed_landmark);
    txt_lat = (TextView) findViewById(R.id.txt_lat);
    txt_lng = (TextView) findViewById(R.id.txt_lng);

    ed_house_number = (EditText) findViewById(R.id.ed_house_number);
    ed_Birth_date = (EditText) findViewById(R.id.ed_Birth_date);
    ed_Mobile_number = (EditText) findViewById(R.id.ed_Mobile_number);

    sp_family_cast = (Spinner) findViewById(R.id.sp_family_cast);
    sp_family_dharm = (Spinner) findViewById(R.id.sp_family_dharm);
    sp_street_name = (Spinner) findViewById(R.id.sp_street_name);
    sp_Marital_status = (Spinner) findViewById(R.id.sp_Marital_status);
    sp_aganvali = (Spinner) findViewById(R.id.sp_aganvali);

    rdb_yes = (RadioButton) findViewById(R.id.rdb_yes);
    rdb_no = (RadioButton) findViewById(R.id.rdb_no);
    rdb_sex_Male = (RadioButton) findViewById(R.id.rdb_sex_Male);
    rdb_sex_Female = (RadioButton) findViewById(R.id.rdb_sex_Female);

    bt_family_identity = (Button) findViewById(R.id.bt_family_identity);
    bt_family_location = (TextView) findViewById(R.id.bt_family_location);
    bt_add_family = (Button) findViewById(R.id.bt_add_family);
    imgUserImage = (ImageView) findViewById(R.id.imgUserImage);

    Typeface type = Typeface.createFromAsset(getAssets(), "SHRUTI.TTF");
    bt_add_family.setTypeface(type, Typeface.BOLD);
    txt_lbl_village.setTypeface(type, Typeface.BOLD);
    txt_village_name.setTypeface(type, Typeface.BOLD);
    txt_village_name.setText(villageName);
    lbl_family_number.setTypeface(type, Typeface.BOLD);
    lbl_yes.setTypeface(type, Typeface.BOLD);
    lbl_no.setTypeface(type, Typeface.BOLD);
    lbl_bpl.setTypeface(type, Typeface.BOLD);
    lbl_house_number.setTypeface(type, Typeface.BOLD);
    lbl_family_cast.setTypeface(type, Typeface.BOLD);
    lbl_family_dharm.setTypeface(type, Typeface.BOLD);
    bt_family_location.setTypeface(type, Typeface.BOLD);
    bt_family_identity.setTypeface(type, Typeface.BOLD);
    ed_house_number.setTypeface(type, Typeface.BOLD);
    rdb_yes.setTypeface(type, Typeface.BOLD);
    rdb_no.setTypeface(type, Typeface.BOLD);
    ed_family_number.setTypeface(type, Typeface.BOLD);

    txt_village_name.setText(villageName);

    SharedPreferences sharedPreferences =
        thisActivity.getSharedPreferences(Constants.USER_LOGIN_PREF, MODE_PRIVATE);
    String userDetail = sharedPreferences.getString(Constants.USER_ID, null);
    try {
      JSONObject jsonObject = new JSONObject(userDetail);
      String subCenterId =
          jsonObject.getJSONArray("userdetails").getJSONObject(0).getString("subcentreId");
      String userId = jsonObject.getJSONArray("userdetails").getJSONObject(0).getString("userId");
      Random emamtaRandom = new Random();
      int emamId = emamtaRandom.nextInt(900) + 100;

      Calendar calendar = Calendar.getInstance();
      int year = calendar.get(Calendar.YEAR);

      String strEmamtaId = "FM/" + year + "/" + userId + "" + emamId;
      ed_family_number.setText(strEmamtaId);
      ed_family_number.setEnabled(false);

    } catch (JSONException e) {
      e.printStackTrace();
    }

    bt_family_identity.setOnClickListener(this);
    txt_add_location.setOnClickListener(this);
    bt_add_family.setOnClickListener(this);
    rdb_yes.setOnClickListener(this);
    rdb_no.setOnClickListener(this);
    rdb_no.setOnClickListener(this);
    rdb_sex_Male.setOnClickListener(this);
    rdb_sex_Female.setOnClickListener(this);
    ed_Birth_date.setOnClickListener(this);
    imgUserImage.setOnClickListener(this);
    txt_take_image.setOnClickListener(this);
    txt_add_street.setOnClickListener(this);

    sp_family_dharm.setOnItemSelectedListener(this);
    sp_family_cast.setOnItemSelectedListener(this);
    sp_street_name.setOnItemSelectedListener(this);
    sp_Marital_status.setOnItemSelectedListener(this);
    sp_aganvali.setOnItemSelectedListener(this);
  }