public Earthquake(double magnitude, String location, long timeInMilliseconds){ mMagnitude = magnitude; mLocation = location; mTimeInMilliseconds = timeInMilliseconds; } public double getMagnitude(){ return mMagnitude; }
import java.text.DecimalFormat; @Override public View getView(int postion, View convertView, ViewGroup parent){ TextView magnitudeView = (TextView) listItemView.findViewById(R.id.magnitude); String formattedMagnitude = formatMagnitude(currentEarthquake.getMagnitude()); magnitudeView.setText(formattedMagnitude); private String formatMagnitude(double magnitude){ DecimalFormat magnitudeFormat = new DecimalFormat("0.0"); return magnitudeFormat.format(magnitude); } }