您好我正在尝试创建将响应CalendarView上的点击日期的应用,将获得所选日期并将其显示在textview中,这是我的代码:
public class MyOrganiser1Activity extends Activity {
/** Called when the activity is first created. */
TextView dateView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
CalendarView calendas = (CalendarView)findViewById(R.id.calendarView1);
dateView = (TextView)findViewById(R.id.dateView1);
calendas.setOnDateChangeListener( new CalendarView.OnDateChangeListener() {
private GregorianCalendar calendar;
public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) {
this.calendar = new GregorianCalendar(year, month, dayOfMonth);
SimpleDateFormat ss = new SimpleDateFormat("yyyy-MM-dd");
String currentdate= ss.format(calendar);
dateView.setText(currentdate);
}
});
}
}
我的问题是:一旦我运行此代码;我的应用崩溃了。调试信息:“找不到DataSetObservable.class的android.java”。然而;我甚至不知道上面的代码是否正确。