2016-09-14 10 views
0

Android Marshmallowでアプリを更新しようとしています。android.widget.DayPickerViewがAndroid Marshmallowでアクセスできない

私が持っているDatePickerとその中TimePickerDialog

   <DatePicker 
       android:id="@+id/new_task_date_picker" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:calendarViewShown="false" 
       android:background="@color/gray_overlay" 
       android:layout_gravity="center_horizontal" 
       android:layout_marginRight="@dimen/margin_normal" 
       android:layout_marginEnd="@dimen/margin_normal" 
       android:layout_marginBottom="@dimen/margin_large" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/new_task_hour" 
       android:textColor="@color/dark_gray" 
       android:textSize="@dimen/text_normal" 
       android:layout_marginBottom="@dimen/margin_normal" /> 

      <TimePicker 
       android:id="@+id/new_task_time_picker" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:timePickerMode="spinner" 
       android:background="@color/gray_overlay" /> 

それはアンドロイド5に取り組んでいますが、私は、私は「ときに私はこのエラーを取得するアンドロイド6を得たデバイス上でテストするときダイアログボックスを拡張しようとしています:

android.view.InflateException: Binary XML file line #116: Binary XML file line #116: Error inflating class android.widget.DatePicker 
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:539) 
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                   at com.ikomobi.alptis.main.task.NewTaskDialogFragment.onCreateView(NewTaskDialogFragment.java:80) 
                   at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
                   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
                   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
                   at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) 
                   at android.os.Handler.handleCallback(Handler.java:739) 
                   at android.os.Handler.dispatchMessage(Handler.java:95) 
                   at android.os.Looper.loop(Looper.java:148) 
                   at android.app.ActivityThread.main(ActivityThread.java:5417) 
                   at java.lang.reflect.Method.invoke(Native Method) 
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                   Caused by: android.view.InflateException: Binary XML file line #116: Error inflating class android.widget.DatePicker 
                   at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
                   at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
                   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
                   at com.ikomobi.alptis.main.task.NewTaskDialogFragment.onCreateView(NewTaskDialogFragment.java:80)  
                   at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)  
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)  
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)  
                   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)  
                   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)  
                   at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)  
                   at android.os.Handler.handleCallback(Handler.java:739)  
                   at android.os.Handler.dispatchMessage(Handler.java:95)  
                   at android.os.Looper.loop(Looper.java:148)  
                   at android.app.ActivityThread.main(ActivityThread.java:5417)  
                   at java.lang.reflect.Method.invoke(Native Method)  
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  
                   Caused by: java.lang.reflect.InvocationTargetException 
                   at java.lang.reflect.Constructor.newInstance(Native Method) 
                   at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
                   at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)  
                   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)  
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)  
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
                   at com.ikomobi.alptis.main.task.NewTaskDialogFragment.onCreateView(NewTaskDialogFragment.java:80)  
                   at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)  
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)  
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)  
                   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)  
                   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)  
                   at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)  
                   at android.os.Handler.handleCallback(Handler.java:739)  
                   at android.os.Handler.dispatchMessage(Handler.java:95)  
                   at android.os.Looper.loop(Looper.java:148)  
                   at android.app.ActivityThread.main(ActivityThread.java:5417)  
                   at java.lang.reflect.Method.invoke(Native Method)  
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  
                   Caused by: android.view.InflateException: Binary XML file line #28: Binary XML file line #27: Error inflating class android.widget.DayPickerView 
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:539) 
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                   at android.widget.DatePickerCalendarDelegate.<init>(DatePickerCalendarDelegate.java:118) 
                   at android.widget.DatePicker.createCalendarUIDelegate(DatePicker.java:160) 
                   at android.widget.DatePicker.<init>(DatePicker.java:140) 
                   at android.widget.DatePicker.<init>(DatePicker.java:126) 
                   at android.widget.DatePicker.<init>(DatePicker.java:122) 
                   at java.lang.reflect.Constructor.newInstance(Native Method)  
                   at android.view.LayoutInflater.createView(LayoutInflater.java:619)  
                   at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)  
                   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)  
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)  
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
                   at com.ikomobi.alptis.main.task.NewTaskDialogFragment.onCreateView(NewTaskDialogFragment.java:80)  
                   at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)  
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)  
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)  
                   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)  
                   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)  
                   at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)  
                   at android.os.Handler.handleCallback(Handler.java:739)  
                   at android.os.Handler.dispatchMessage(Handler.java:95)  
                   at android.os.Looper.loop(Looper.java:148)  
                   at android.app.ActivityThread.main(ActivityThread.java:5417)  
                   at java.lang.reflect.Method.invoke(Native Method)  
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  
                   Caused by: android.view.InflateException: Binary XML file line #27: Error inflating class android.widget.DayPickerView 
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782) 
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                   at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971) 
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:831) 
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
                   at android.widget.DatePickerCalendarDelegate.<init>(DatePickerCalendarDelegate.java:118)  
                   at android.widget.DatePicker.createCalendarUIDelegate(DatePicker.java:160)  
                   at android.widget.DatePicker.<init>(DatePicker.java:140)  
                   at android.widget.DatePicker.<init>(DatePicker.java:126)  
                   at android.widget.DatePicker.<init>(DatePicker.java:122)  
                   at java.lang.reflect.Constructor.newInstance(Native Method)  
                   at android.view.LayoutInflater.createView(LayoutInflater.java:619)  
                   at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)  
                   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)  
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)  
                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  
                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  
                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
                   at com.ikomobi.alptis.main.task.NewTaskDialogFragment.onCreateView(NewTaskDialogFragment.java:80)  
                   at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)  
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)  
                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)  
                   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)  
                   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)  
                   at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)  
                   at android.os.Handler.handleCallback(Handler.java:739)  
                   at android.os.Handler.dispatchMessage(Handler.java:95)  
                   at android.os.Looper.loop(Looper.java:148)  
                   at android.app.ActivityThread.main(ActivityThread.java:5417)  
                   at java.lang.reflect.Method.invoke(Native Method)  
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  
                   Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: java.lang.Class<android.widget.DayPickerView> is not access 

と私のアプリケーションがクラッシュします。

私のアプリケーションでは、すべての自動化が許可されていますが、何が起こっているのかわかりません。アイデアはありますか?

EDIT:この1の後

android:spinnersShown="true" 

android:calendarViewShown="false" 

それは実際にdialogFragmentだ

、私はこの行を追加し、正確なこと...

答えて

0

試してみる必要があります編集:これは私のコードonCreateのダイアログ:

public class DateTimeDialog extends Dialog implements android.view.View.OnClickListener { 

    protected void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      requestWindowFeature(Window.FEATURE_NO_TITLE); 
      setContentView(R.layout.datetimedialog); 

これは私のXMLです:

ちょうどこのコンストラクタを使用して
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    style="@style/fragstyle" 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:text="@string/please_select" 
     android:id="@+id/textViewDlgHead" 
     android:layout_gravity="center_horizontal" 
     style="@style/text" /> 

    <DatePicker 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/datePicker" 
     android:layout_weight="1" 
     android:calendarViewShown="false" 
     android:spinnersShown="true" 
     android:datePickerMode="spinner" /> 

    <TimePicker 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/timePicker" 
     android:layout_gravity="center_horizontal" 
     android:touchscreenBlocksFocus="false" 
     android:timePickerMode="spinner" /> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:touchscreenBlocksFocus="false"> 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="OK" 
      android:id="@+id/btnclosedialog" 
      android:layout_weight="1" 
      style="@style/button" /> 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/cancel" 
      android:id="@+id/btncanceldialog" 
      android:layout_weight="1" 
      style="@style/button" /> 
    </LinearLayout> 

</LinearLayout> 
+0

動作しませんが、まだエラーがあります。 –

+0

を編集しました - これを試してみてください –

+0

実際にはダイアログの断片ですが、既にダイアログにFEATURE_NO_TITLEをリクエストしています –

0

public DatePickerDialog(Context context, int themeResId, DatePickerDialog.OnDateSetListener listener, int year, int monthOfYear, int dayOfMonth) 

の代わり:

public DatePickerDialog(Context context, DatePickerDialog.OnDateSetListener listener, int year, int month, int dayOfMonth) 
私の作品

関連する問題