2013-07-28 23 views
0

我的代碼將當前月份作爲數字返回,例如,如果月份是7月份,代碼將顯示7(請參閱圖片鏈接)。 http://imgur.com/Rvf8QYp 如何根據數字打印月份名稱?如何獲得月份價值與數量?

public void showOnScreen() { 


    date_today.setText(mYear + "Years" + mMonth + "Month"); 
    e00.setText("" + a[0][0]); 
    e01.setText("" + a[0][1]); 
    e02.setText("" + a[0][2]); 
    e03.setText("" + a[0][3]); 
    e04.setText("" + a[0][4]); 
    e05.setText("" + a[0][5]); 
    e06.setText("" + a[0][6]); 

} 
+0

沒有我得到月號我要打印一個月NAE針對其數量在這個變量mMonth – user2619496

+0

howi使用一樣,如果( mMonth = 1 {mMonth == January}或者使用switch case我使用了什麼和如何? – user2619496

+1

爲什麼你不讀取我鏈接的問題的答案? – Simon

回答

1

java.util.Calendar類的方法getDisplayName

Calendar calendar = new Calendar(); 
String date_plaintext = calendar.getDisplayName(mMonth, Calendar.LONG, Locale.US); 
date_today.setText(date_plaintext+ ", " + mYear);