birthday.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final AlertDialog dialog = new AlertDialog.Builder(EditActivity.this).create();
dialog.show();
DatePicker picker = new DatePicker(EditActivity.this);
// picker.setDate(2015, 10);
picker.setMode(DPMode.SINGLE);
picker.setFestivalDisplay(false);
picker.setTodayDisplay(false);
picker.setHolidayDisplay(false);
picker.setDeferredDisplay(false);
picker.setOnDatePickedListener(new DatePicker.OnDatePickedListener() {
@Override
public void onDatePicked(String date) {
// Toast.makeText(TeacherEditActivity.this, date, Toast.LENGTH_LONG).show();
birthday.setText(date);
dialog.dismiss();
}
});
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
dialog.getWindow().setContentView(picker, params);
dialog.getWindow().setGravity(Gravity.CENTER);
}
});
异常:
05-22 00:40:52.614 6443-6443/com.cloudwave.skm E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
05-22 00:40:52.690 6443-6443/com.cloudwave.skm E/libEGL: load_driver driver_absolute_path:/system/lib/egl/libEGL_emulation.so
05-22 00:40:52.698 6443-6443/com.cloudwave.skm E/libEGL: load_driver driver_absolute_path:/system/lib/egl/libGLESv1_CM_emulation.so
05-22 00:40:52.698 6443-6443/com.cloudwave.skm E/libEGL: load_driver driver_absolute_path:/system/lib/egl/libGLESv2_emulation.so
05-22 00:41:12.554 6443-6443/com.cloudwave.skm E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.cloudwave.skm, PID: 6443
java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
at cn.aigestudio.datepicker.bizs.calendars.DPCNCalendar.getFestivalG(DPCNCalendar.java:216)
at cn.aigestudio.datepicker.bizs.calendars.DPCNCalendar.buildMonthL(DPCNCalendar.java:137)
at cn.aigestudio.datepicker.bizs.calendars.DPCNCalendar.buildMonthFestival(DPCNCalendar.java:107)
at cn.aigestudio.datepicker.bizs.calendars.DPCManager.buildDPInfo(DPCManager.java:177)
at cn.aigestudio.datepicker.bizs.calendars.DPCManager.obtainDPInfo(DPCManager.java:154)
at cn.aigestudio.datepicker.views.MonthView.draw(MonthView.java:314)
at cn.aigestudio.datepicker.views.MonthView.onDraw(MonthView.java:280)
at android.view.View.draw(View.java:14465)
at android.view.View.getDisplayList(View.java:13362)
at android.view.View.getDisplayList(View.java:13404)
at android.view.View.draw(View.java:14182)
at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
at android.view.View.getDisplayList(View.java:13357)
at android.view.View.getDisplayList(View.java:13404)
at android.view.View.draw(View.java:14182)
at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
at android.view.View.getDisplayList(View.java:13357)
at android.view.View.getDisplayList(View.java:13404)
at android.view.View.draw(View.java:14182)
at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
at android.view.View.getDisplayList(View.java:13357)
at android.view.View.getDisplayList(View.java:13404)
at android.view.View.draw(View.java:14182)
at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
at android.view.View.draw(View.java:14468)
at android.widget.FrameLayout.draw(FrameLayout.java:472)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2326)
at android.view.View.getDisplayList(View.java:13362)
at android.view.View.getDisplayList(View.java:13404)
at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1570)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1449)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2405)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2277)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1907)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1024)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5694)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5045)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
代码:
异常: