如何解决ClassCastException?

时间:2016-08-23 06:39:19

标签: android

public void showDateTimeFrameDialog(){
    Calendar now = Calendar.getInstance();
    com.borax12.materialdaterangepicker.date.DatePickerDialog dpd = com.borax12.materialdaterangepicker.date.DatePickerDialog.newInstance(PaymentHistoryFragment.this,now.get(Calendar.YEAR),now.get(Calendar.MONTH),now.get(Calendar.DAY_OF_MONTH));
    dpd.show(getActivity().getFragmentManager(), "Datepickerdialog");
} 

我正在使用两个不同的DatePickerDialog库

https://github.com/wdullaer/MaterialDateTimePickerhttps://github.com/borax12/MaterialDateRangePicker作为我的应用中的依赖项,当我点击com.borax12.materialdaterangepicker.date.DatePickerDialog时。它显示出以下例外情况。

    java.lang.ClassCastException:com.wdullaer.materialdatetimepicker.date.AccessibleDateAnimator cannot be cast to com.borax12.materialdaterangepicker.date.AccessibleDateAnimator 
                      at   com.borax12.materialdaterangepicker.date.DatePickerDialog.onCreateView(DatePickerDialog.java:371)
                      at android.app.Fragment.performCreateView(Fragment.java:2069)
                      at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:899)
                      at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1072)
                      at android.app.BackStackRecord.run(BackStackRecord.java:851)
                      at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
                      at android.app.FragmentManagerImpl$1.run(FragmentManager.java:452)
                      at android.os.Handler.handleCallback(Handler.java:815)
                      at android.os.Handler.dispatchMessage(Handler.java:104)
                      at android.os.Looper.loop(Looper.java:194)
                      at android.app.ActivityThread.main(ActivityThread.java:5537)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at java.lang.reflect.Method.invoke(Method.java:372)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
                      at  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)

0 个答案:

没有答案