このコードでは、スピナーで現在の年を表示します。現在の月も表示したいと思います。どうやって?ありがとう
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;
}