使用此代码,我在微调器中查看当前年份,现在我还想查看当前月份。如何?谢谢
if (years.size() == 0){
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
int currentMonth = Calendar.getInstance().get(Calendar.MONTH) + 1;
years.add(currentYear+"/"+currentMonth);
}
SpinnerAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, years);
yearSelector.setAdapter(adapter);
yearSelector.setSelection(0);
yearSelector.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view,
int position, long id) {
String anno = years.get(position);
showDetails(anno);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
return;
}