Code example for DecimalFormat

Methods: applyPatternformat

0
    } 
 
    private String formatDegree(double value, String positiveHemi,
            String negativeHemi) {
        DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance();
        fmt.applyPattern("0.00000");
        String hemi = value > 0 ? positiveHemi : negativeHemi;
        return fmt.format(value) + " \u00b0" + hemi;
    } 
 
    private void createTag() { 
        if (ClientState.getState().isConnected()) { 
            Intent returnValue = new Intent();
            returnValue.putExtra(EXTRA_LOCATION, location);
            returnValue.putExtra(EXTRA_NAME, editName.getText().toString());
            returnValue.putExtra(EXTRA_TEXT, editText.getText().toString());
            setResult(RESULT_OK, returnValue);
            finish();
        } else { 
            Toast.makeText(this, R.string.showmap_toast_nonetwork,
Experience pair programming with AI  Get Codota for Java