Code example for NumberFormat

Methods: setMaximumFractionDigits, setMinimumFractionDigits

0
 
		public MyBaseAdapter(Context ctx, List<Card> listCards) {
			this.listCards = listCards;
			this.ctx = ctx;
			format= NumberFormat.getInstance(locale);  
			format.setMaximumFractionDigits(2);  
			format.setMinimumFractionDigits(2);
		} 
 
		public int getCount() { 
			return listCards.size();
		} 
 
		public Object getItem(int position) {
			return listCards.get(position);
		} 
 
		public long getItemId(int position) {
			return listCards.get(position).getNumber();
		}