Buggy code:
public class DistanceDialogFragment extends DialogFragment implements OnClickListener { public static final String TAG = DistanceDialogFragment . class . getSimpleName ( ) ; private static final String ARG_SUGGESTED_DATE = "arg_suggested_date" ; private EditText mDistance ; private EditText mRate ; private EditText mComment ; private AutoCompleteTextView mLocation ; private DateEditText mDate ; private Spinner mCurrency ; private Trip mTrip ; private Distance mUpdateableDistance ; private DatabaseHelper mDB ; private Preferences mPrefs ; private DateManager mDateManager ; private AutoCompleteAdapter mLocationAutoCompleteAdapter ; private Date mSuggestedDate ; public static DistanceDialogFragment newInstance ( final Trip trip ) { } public static DistanceDialogFragment newInstance ( final Trip trip , final Date suggestedDate ) { } public static DistanceDialogFragment newInstance ( final Trip trip , final Distance distance ) { } private static DistanceDialogFragment newInstance ( final Trip trip , final Distance distance , final Date suggestedDate ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override @ NonNull public Dialog onCreateDialog ( Bundle savedInstanceState ) { final LayoutInflater inflater = LayoutInflater . from ( getActivity ( ) ) ; final View rootView = inflater . inflate ( dialog_mileage , null ) ; mDistance = ( ( EditText ) ( rootView . findViewById ( dialog_mileage_distance ) ) ) ; mRate = ( ( EditText ) ( rootView . findViewById ( dialog_mileage_rate ) ) ) ; mCurrency = ( ( Spinner ) ( rootView . findViewById ( dialog_mileage_currency ) ) ) ; mLocation = ( ( AutoCompleteTextView ) ( rootView . findViewById ( dialog_mileage_location ) ) ) ; mComment = ( ( EditText ) ( rootView . findViewById ( dialog_mileage_comment ) ) ) ; mDate = ( ( DateEditText ) ( rootView . findViewById ( dialog_mileage_date ) ) ) ; final ArrayAdapter < CharSequence > currencies = new ArrayAdapter < CharSequence > ( getActivity ( ) , layout . simple_spinner_item , mDB . getCurrenciesList ( ) ) ; currencies . setDropDownViewResource ( simple_spinner_dropdown_item ) ; mCurrency . setAdapter ( currencies ) ; mDate . setOnClickListener ( getDateManager ( ) . getDateEditTextListener ( ) ) ; mDate . setFocusable ( false ) ; mDate . setFocusableInTouchMode ( false ) ; final AlertDialog . Builder builder = new AlertDialog . Builder ( getActivity ( ) ) ; builder . setView ( rootView ) ; if ( ( mUpdateableDistance ) == null ) { builder . setTitle ( getString ( dialog_mileage_title_create ) ) ; builder . setPositiveButton ( getString ( dialog_mileage_positive_create ) , this ) ; mDate . date = mSuggestedDate ; mDate . setText ( DateFormat . getDateFormat ( getActivity ( ) ) . format ( mDate . date ) ) ; int idx = currencies . getPosition ( mTrip . getPrice ( ) . getCurrencyCode ( ) ) ; if ( idx > 0 ) { mCurrency . setSelection ( idx ) ; } if ( mPrefs . hasDefaultDistanceRate ( ) ) { <START_BUG> mRate . setText ( ModelUtils . getDecimalFormattedValue ( mPrefs . getDefaultDistanceRate ( ) ) ) ; <END_BUG> } if ( ( mLocationAutoCompleteAdapter ) == null ) { mLocationAutoCompleteAdapter = AutoCompleteAdapter . getInstance ( getActivity ( ) , TAG_DISTANCE_LOCATION , mDB ) ; } else { mLocationAutoCompleteAdapter . reset ( ) ; } mLocation . setAdapter ( mLocationAutoCompleteAdapter ) ; } else { builder . setTitle ( getString ( dialog_mileage_title_update ) ) ; builder . setPositiveButton ( getString ( dialog_mileage_positive_update ) , this ) ; builder . setNeutralButton ( getString ( dialog_mileage_neutral_delete ) , this ) ; mDistance . setText ( mUpdateableDistance . getDecimalFormattedDistance ( ) ) ; mRate . setText ( mUpdateableDistance . getDecimalFormattedRate ( ) ) ; mLocation . setText ( mUpdateableDistance . getLocation ( ) ) ; mComment . setText ( mUpdateableDistance . getComment ( ) ) ; mDate . setText ( mUpdateableDistance . getFormattedDate ( getActivity ( ) , mPrefs . getDateSeparator ( ) ) ) ; mDate . date = mUpdateableDistance . getDate ( ) ; int idx = currencies . getPosition ( mUpdateableDistance . getPrice ( ) . getCurrencyCode ( ) ) ; if ( idx > 0 ) { mCurrency . setSelection ( idx ) ; } } builder . setNegativeButton ( cancel , this ) ; final Dialog dialog = builder . create ( ) ; getDateManager ( ) . setDateEditTextListenerDialogHolder ( dialog ) ; return dialog ; } @ Override public void onPause ( ) { } @ Override public void onClick ( DialogInterface dialog , int which ) { } private BigDecimal getBigDecimalFromString ( String number , BigDecimal fallback ) { } private DateManager getDateManager ( ) { } }

Fix:
mRate . setText ( ModelUtils . getDecimalFormattedValue ( new BigDecimal ( mPrefs . getDefaultDistanceRate ( ) ) , RATE_PRECISION ) ) ;