{"action":"closed","issue":{"url":"https://api.github.com/repos/madisp/pretty/issues/1","labels_url":"https://api.github.com/repos/madisp/pretty/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/madisp/pretty/issues/1/comments","events_url":"https://api.github.com/repos/madisp/pretty/issues/1/events","html_url":"https://github.com/madisp/pretty/issues/1","id":63748565,"number":1,"title":"Add fragment dynamically cause crash","user":{"login":"mahdihijazi","id":836892,"avatar_url":"https://avatars.githubusercontent.com/u/836892?v=3","gravatar_id":"","url":"https://api.github.com/users/mahdihijazi","html_url":"https://github.com/mahdihijazi","followers_url":"https://api.github.com/users/mahdihijazi/followers","following_url":"https://api.github.com/users/mahdihijazi/following{/other_user}","gists_url":"https://api.github.com/users/mahdihijazi/gists{/gist_id}","starred_url":"https://api.github.com/users/mahdihijazi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mahdihijazi/subscriptions","organizations_url":"https://api.github.com/users/mahdihijazi/orgs","repos_url":"https://api.github.com/users/mahdihijazi/repos","events_url":"https://api.github.com/users/mahdihijazi/events{/privacy}","received_events_url":"https://api.github.com/users/mahdihijazi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-23T15:18:10Z","updated_at":"2015-03-29T19:15:15Z","closed_at":"2015-03-29T19:15:15Z","body":"Adding fragment dynamically like this:\r\n```\r\ngetSupportFragmentManager().beginTransaction().add(R.id.container, new SampleFragment()).commit();\r\n```\r\nwill cause a crash:\r\n```\r\n    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.madisp.pretty.samples/com.madisp.pretty.samples.SampleActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class <unknown>\r\n            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)\r\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)\r\n            at android.app.ActivityThread.access$800(ActivityThread.java:144)\r\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)\r\n            at android.os.Handler.dispatchMessage(Handler.java:102)\r\n            at android.os.Looper.loop(Looper.java:135)\r\n            at android.app.ActivityThread.main(ActivityThread.java:5221)\r\n            at java.lang.reflect.Method.invoke(Native Method)\r\n            at java.lang.reflect.Method.invoke(Method.java:372)\r\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)\r\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)\r\n     Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class <unknown>\r\n            at android.view.LayoutInflater.createView(LayoutInflater.java:633)\r\n            at com.madisp.pretty.LayoutFactoryWrapper.onCreateView(LayoutFactoryWrapper.java:42)\r\n            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)\r\n            at android.view.LayoutInflater.inflate(LayoutInflater.java:482)\r\n            at android.view.LayoutInflater.inflate(LayoutInflater.java:414)\r\n            at com.madisp.pretty.samples.SampleFragment.onCreateView(SampleFragment.java:12)\r\n            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)\r\n            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)\r\n            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)\r\n            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)\r\n            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)\r\n            at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:548)\r\n            at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)\r\n            at android.app.Activity.performStart(Activity.java:5949)\r\n            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)\r\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)\r\n            at android.app.ActivityThread.access$800(ActivityThread.java:144)\r\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)\r\n            at android.os.Handler.dispatchMessage(Handler.java:102)\r\n            at android.os.Looper.loop(Looper.java:135)\r\n            at android.app.ActivityThread.main(ActivityThread.java:5221)\r\n            at java.lang.reflect.Method.invoke(Native Method)\r\n            at java.lang.reflect.Method.invoke(Method.java:372)\r\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)\r\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)\r\n     Caused by: java.lang.reflect.InvocationTargetException\r\n            at java.lang.reflect.Constructor.newInstance(Native Method)\r\n            at java.lang.reflect.Constructor.newInstance(Constructor.java:288)\r\n            at android.view.LayoutInflater.createView(LayoutInflater.java:607)\r\n            at com.madisp.pretty.LayoutFactoryWrapper.onCreateView(LayoutFactoryWrapper.java:42)\r\n            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)\r\n            at android.view.LayoutInflater.inflate(LayoutInflater.java:482)\r\n            at android.view.LayoutInflater.inflate(LayoutInflater.java:414)\r\n            at com.madisp.pretty.samples.SampleFragment.onCreateView(SampleFragment.java:12)\r\n            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)\r\n            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)\r\n            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)\r\n            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)\r\n            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)\r\n            at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:548)\r\n            at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)\r\n            at android.app.Activity.performStart(Activity.java:5949)\r\n            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)\r\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)\r\n            at android.app.ActivityThread.access$800(ActivityThread.java:144)\r\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)\r\n            at android.os.Handler.dispatchMessage(Handler.java:102)\r\n            at android.os.Looper.loop(Looper.java:135)\r\n            at android.app.ActivityThread.main(ActivityThread.java:5221)\r\n            at java.lang.reflect.Method.invoke(Native Method)\r\n            at java.lang.reflect.Method.invoke(Method.java:372)\r\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)\r\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)\r\n     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference\r\n            at android.view.ViewConfiguration.get(ViewConfiguration.java:359)\r\n            at android.view.View.<init>(View.java:3580)\r\n            at android.view.View.<init>(View.java:3675)\r\n            at android.view.ViewGroup.<init>(ViewGroup.java:491)\r\n            at android.widget.LinearLayout.<init>(LinearLayout.java:200)\r\n            at android.widget.LinearLayout.<init>(LinearLayout.java:196)\r\n            at android.widget.LinearLayout.<init>(LinearLayout.java:192)\r\n            at java.lang.reflect.Constructor.newInstance(Native Method)\r\n            at java.lang.reflect.Constructor.newInstance(Constructor.java:288)\r\n            at android.view.LayoutInflater.createView(LayoutInflater.java:607)\r\n            at com.madisp.pretty.LayoutFactoryWrapper.onCreateView(LayoutFactoryWrapper.java:42)\r\n            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)\r\n            at android.view.LayoutInflater.inflate(LayoutInflater.java:482)\r\n            at android.view.LayoutInflater.inflate(LayoutInflater.java:414)\r\n            at com.madisp.pretty.samples.SampleFragment.onCreateView(SampleFragment.java:12)\r\n            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)\r\n            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)\r\n            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)\r\n            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)\r\n            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)\r\n            at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:548)\r\n            at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)\r\n            at android.app.Activity.performStart(Activity.java:5949)\r\n            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)\r\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)\r\n            at android.app.ActivityThread.access$800(ActivityThread.java:144)\r\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)\r\n            at android.os.Handler.dispatchMessage(Handler.java:102)\r\n            at android.os.Looper.loop(Looper.java:135)\r\n            at android.app.ActivityThread.main(ActivityThread.java:5221)\r\n            at java.lang.reflect.Method.invoke(Native Method)\r\n            at java.lang.reflect.Method.invoke(Method.java:372)\r\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)\r\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)\r\n```"}}