Android examples for java.text:DecimalFormat
format Amount ###,###,##0.00
import java.text.DecimalFormat; import android.text.Editable; import android.text.Selection; import android.text.Spannable; import android.text.TextWatcher; import android.widget.EditText; public class Main{ // w w w . java 2s .co m public static String formatAmount(String amount) { if (CommonUtils.isEmpty(amount)) return "0.00"; // return formatSpecialAmount(amount); return formatQueryAmount(amount); } public static String formatQueryAmount(String amount) { DecimalFormat format = new DecimalFormat("###,###,##0.00"); return format.format(Double.valueOf(amount)); } }