目前我正在尝试获取日期(特定月份和年份)并使用TextView显示它,但我的程序正在强制关闭。
这是我“得到”月份和年份的地方。
Calendar cCalendar = Calendar.getInstance();
int currentYear = cCalendar.get(Calendar.YEAR);
int currentMonth = cCalendar.get(Calendar.MONTH);这里是我设置TextView文本的地方。
public void setDateLabel(View v)
{
TextView month = (TextView)findViewById(R.id.monthLabel);
TextView year = (TextView)findViewById(R.id.yearLabel);
year.setText(currentYear);
month.setText(currentMonth);
}这里是带有TextView和Button的XML。
我尝试在Debug中运行它以获得LogCat,但调试器停止并等待其“附加”在端口8634上。