private void checkUnitAndRefresh() {
    Debug.e("", "Refreshing...");

    String selectedUnit = converter.getSelectedUnit();
    ArrayList<String> unitList = converter.getFavUnitName();

    if (!unitList.contains(selectedUnit)) {
      Utils.setPref(getActivity(), Constant.SELECTED_UNIT_STORAGE, MyStorageUnitConverter.BYTE);
      tvUnitSelVal.setText(MyStorageUnitConverter.BYTE);
    }

    mAdapter.addAll(converter.getFavUnit());
  }
  private void init() {
    converter = new MyStorageUnitConverter(getActivity());

    TextView tvTitleText = (TextView) findViewById(R.id.tvTitleText);
    tvTitleText.setTypeface(Utils.getBold(getActivity()));
    tvTitleText.setText(R.string.title_unit);

    Button btnMenu = (Button) findViewById(R.id.btnMenu);
    btnMenu.setOnClickListener(menuClickListener);

    TextView tvUnitSelKey = (TextView) findViewById(R.id.tvUnitSelKey);
    tvUnitSelKey.setTypeface(Utils.getBold(getActivity()));
    tvUnitSelVal = (TextView) findViewById(R.id.tvUnitSelVal);
    tvUnitSelVal.setTypeface(Utils.getBold(getActivity()));
    tvUnitSelVal.setText(converter.getSelectedUnit());
    tvUnitSelVal.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            showUnitSpinner(converter.getUnitList().toArray(new String[0]));
          }
        });

    TextView tvUnitValueKey = (TextView) findViewById(R.id.tvUnitValueKey);
    tvUnitValueKey.setTypeface(Utils.getBold(getActivity()));
    tvUnitValueVal = (TextView) findViewById(R.id.tvUnitValueVal);
    tvUnitValueVal.setTypeface(Utils.getBold(getActivity()));
    tvUnitValueVal.setText("" + converter.getSelectedValue());
    tvUnitValueVal.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            CalcFragment calc = new CalcFragment();
            calc.show(getSupportFragmentManager(), "");
          }
        });

    mAdapter = new ConverterStorageAdapter(getActivity(), R.layout.unit_converter_item);
    lvUnitConverter = (DragSortListView) findViewById(R.id.lvUnitConverter);
    lvUnitConverter.setDropListener(onDrop);
    lvUnitConverter.setAdapter(mAdapter);

    mAdapter.addAll(converter.getFavUnit());

    ImageView imgFavUnit = (ImageView) findViewById(R.id.imgFavUnit);
    imgFavUnit.setOnClickListener(favClickListener);
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 101 && resultCode == Activity.RESULT_OK) {
      converter.refreshCustomUnit();
      checkUnitAndRefresh();
    }
  }
 @Override
 public void onValueSet(String value) {
   converter.setSelectedValue(Double.valueOf(value));
   tvUnitValueVal.setText("" + converter.getSelectedValue());
   mAdapter.addAll(converter.getFavUnit());
 }