Error inflating Fragment in Dialog the second time

前端 未结 6 883
深忆病人
深忆病人 2020-12-03 08:31

I have the following code in an Activity that starts a dialog for a layout that contains a fragment.

...
case R.id.pick_resource:
        dialog = new Dialo         


        
6条回答
  •  爱一瞬间的悲伤
    2020-12-03 09:04

    On android.view.inflateexception: binary xml file line #8: error inflating class fragment error :
    

    Try removing the android:id attribute from your fragment if it exists. and on dismiss dialog add the following code: it works for me

    activity.getFragmentManager().beginTransaction().remove(activity.getFragmentManager().findFragmentById(R.id.mMap_location)).commit();
    

提交回复
热议问题