Code example for Formatter

Methods: close, format

0
		double avg = TanitaDataHelper.getAverage(tanitaData, getColumnName());
		average.setText(format(avg));
	} 
 
	private String format(double prev) {
		Formatter formatter = new Formatter();
		Formatter format = formatter.format("%1.2f", prev);
		String string = format.toString();
		formatter.close();
		return string;
	} 
 
	private int getPersonID() { 
		int id = -1;
		Intent intent = getIntent();
		if (intent != null) {
			Bundle extras = intent.getExtras();
			if (extras == null || !extras.containsKey(BaseAllPeopleListActivity.PERSON_ID)) {
				throw new ExtrasNotSetException("Please add the PERSON_ID in the extras of the Intent"); 
			} 
			id = extras.getInt(BaseAllPeopleListActivity.PERSON_ID);