/**
  * Create an instance of the Picker (used internally)
  *
  * @param reference an (optional) user-defined reference, helpful when tracking multiple Pickers
  * @param themeResId the style resource ID for theming
  * @param minNumber (optional) the minimum possible number
  * @param maxNumber (optional) the maximum possible number
  * @param plusMinusVisibility (optional) View.VISIBLE, View.INVISIBLE, or View.GONE
  * @param decimalVisibility (optional) View.VISIBLE, View.INVISIBLE, or View.GONE
  * @param labelText (optional) text to add as a label
  * @return a Picker!
  */
 public static NumberPickerDialogFragment newInstance(
     int reference,
     int themeResId,
     BigDecimal minNumber,
     BigDecimal maxNumber,
     Integer plusMinusVisibility,
     Integer decimalVisibility,
     String labelText,
     Integer currentNumberValue,
     Double currentDecimalValue,
     Integer currentNumberSign) {
   final NumberPickerDialogFragment frag = new NumberPickerDialogFragment();
   Bundle args = new Bundle();
   args.putInt(REFERENCE_KEY, reference);
   args.putInt(THEME_RES_ID_KEY, themeResId);
   if (minNumber != null) {
     args.putSerializable(MIN_NUMBER_KEY, minNumber);
   }
   if (maxNumber != null) {
     args.putSerializable(MAX_NUMBER_KEY, maxNumber);
   }
   if (plusMinusVisibility != null) {
     args.putInt(PLUS_MINUS_VISIBILITY_KEY, plusMinusVisibility);
   }
   if (decimalVisibility != null) {
     args.putInt(DECIMAL_VISIBILITY_KEY, decimalVisibility);
   }
   if (labelText != null) {
     args.putString(LABEL_TEXT_KEY, labelText);
   }
   if (currentNumberValue != null) {
     args.putInt(CURRENT_NUMBER_KEY, currentNumberValue);
   }
   if (currentDecimalValue != null) {
     args.putDouble(CURRENT_DECIMAL_KEY, currentDecimalValue);
   }
   if (currentNumberSign != null) {
     args.putInt(CURRENT_SIGN_KEY, currentNumberSign);
   }
   frag.setArguments(args);
   return frag;
 }
  /** Instantiate and show the Picker */
  public void show() {
    if (manager == null || styleResId == null) {
      Log.e("NumberPickerBuilder", "setFragmentManager() and setStyleResId() must be called.");
      return;
    }
    final FragmentTransaction ft = manager.beginTransaction();
    final Fragment prev = manager.findFragmentByTag("number_dialog");
    if (prev != null) {
      ft.remove(prev);
    }
    ft.addToBackStack(null);

    final NumberPickerDialogFragment fragment =
        NumberPickerDialogFragment.newInstance(
            mReference,
            styleResId,
            minNumber,
            maxNumber,
            plusMinusVisibility,
            decimalVisibility,
            labelText,
            currentNumberValue,
            currentDecimalValue,
            currentSignValue);
    if (targetFragment != null) {
      fragment.setTargetFragment(targetFragment, 0);
    }
    fragment.setNumberPickerDialogHandlers(mNumberPickerDialogHandlers);
    fragment.setNumberPickerDialogHandlersV2(mNumberPickerDialogHandlersV2);
    fragment.show(ft, "number_dialog");
  }