例外:android.view.InflateException:二进制XML文件行#20:错误膨胀类net.simonvt.datepicker.DatePicker

时间:2014-07-21 09:41:04

标签: java android android-datepicker android-simon-datepicker

我正在研究android应用程序,我正在使用simonvt datepicker库,因为向后兼容但我在我的开发人员控制台崩溃报告中看到有3个报告同样的错误,但我在我的设备中尝试过工作所以这真的很奇怪。

请支持这个为什么它如此奇怪并在某个时候获得例外。

OnDateSetListener date = new OnDateSetListener() {

    private void updateLabel() {

        String myFormat = "EEE, dd MMM"; // In which you need put here
        String myDbFormat = "dd/MM/yyyy";
        SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US);
        SimpleDateFormat DBsdf = new SimpleDateFormat(myDbFormat, Locale.US);
        Departure_date = sdf.format(myCalendar.getTime());
        Departure_date_url = DBsdf.format(myCalendar.getTime());

        Log.i("Departure_date", Departure_date);
        date_btn.setText(sdf.format(myCalendar.getTime()));
    }

    @Override
    public void onDateSet(net.simonvt.datepicker.DatePicker view, int year,
            int monthOfYear, int dayOfMonth) {
        myCalendar.set(Calendar.YEAR, year);
        myCalendar.set(Calendar.MONTH, monthOfYear);
        myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
        updateLabel();
    }
};

行号:703

final net.simonvt.datepicker.DatePickerDialog dpd = new net.simonvt.datepicker.DatePickerDialog(
                            getActivity(), date, myCalendar.get(Calendar.YEAR),
                            myCalendar.get(Calendar.MONTH), myCalendar
                                    .get(Calendar.DAY_OF_MONTH));

Logcat:

android.view.InflateException: Binary XML file line #20: Error inflating class net.simonvt.datepicker.DatePicker
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at net.simonvt.datepicker.DatePickerDialog.<init>(DatePickerDialog.java:106)
at net.simonvt.datepicker.DatePickerDialog.<init>(DatePickerDialog.java:77)
at in.mypackage$15.onClick(RailTicket_Book.java:703)
at android.widget.AutoCompleteTextView$PassThroughClickListener.onClick(AutoCompleteTextView.java:1260)
at android.view.View.performClick(View.java:4471)
at android.view.View$PerformClick.run(View.java:18797)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
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:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
... 19 more
Caused by: java.lang.IllegalArgumentException: Bad pattern character 'E' in EE,dd MMM yyyy
at libcore.icu.ICU.getDateFormatOrder(ICU.java:165)
at android.text.format.DateFormat.getDateFormatOrder(DateFormat.java:388)
at net.simonvt.datepicker.DatePicker.reorderSpinners(DatePicker.java:515)
at net.simonvt.datepicker.DatePicker.<init>(DatePicker.java:284)
at net.simonvt.datepicker.DatePicker.<init>(DatePicker.java:149)
... 22 more

提前致谢

1 个答案:

答案 0 :(得分:1)

我注意到simonvt datepicker中存在一些错误,这是异常的原因。我再次移动到DatePicker那个android提供的工作非常棒,没有任何例外。