Android:Utils
878 ワード
一、NumberFormat
二、
三、
/**
* Number formatter for integers
*/
public static final NumberFormat FORMAT_INT = NumberFormat.getIntegerInstance();
textView.setText(FORMAT_INT.format(number));
二、
/**
*
*
* @param total
* @param count
*/
public static int calculatePage(int total, int count) {
if (total == 0 || count == 0) {
return 0;
}
if (total <= count) {
return 1;
}
int page = total / count;
if (total % count > 0) {
return page + 1;
} else {
return page;
}
}
三、
public static boolean isDigits(String str) {
return (str != null) && TextUtils.isDigitsOnly(str);
}