{"action":"created","issue":{"url":"https://api.github.com/repos/ShamylZakariya/StickyHeaders/issues/18","repository_url":"https://api.github.com/repos/ShamylZakariya/StickyHeaders","labels_url":"https://api.github.com/repos/ShamylZakariya/StickyHeaders/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/ShamylZakariya/StickyHeaders/issues/18/comments","events_url":"https://api.github.com/repos/ShamylZakariya/StickyHeaders/issues/18/events","html_url":"https://github.com/ShamylZakariya/StickyHeaders/issues/18","id":166496366,"number":18,"title":"Null object reference SectioningAdapter.getItemViewType(int)","user":{"login":"achinverma","id":2811593,"avatar_url":"https://avatars.githubusercontent.com/u/2811593?v=3","gravatar_id":"","url":"https://api.github.com/users/achinverma","html_url":"https://github.com/achinverma","followers_url":"https://api.github.com/users/achinverma/followers","following_url":"https://api.github.com/users/achinverma/following{/other_user}","gists_url":"https://api.github.com/users/achinverma/gists{/gist_id}","starred_url":"https://api.github.com/users/achinverma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/achinverma/subscriptions","organizations_url":"https://api.github.com/users/achinverma/orgs","repos_url":"https://api.github.com/users/achinverma/repos","events_url":"https://api.github.com/users/achinverma/events{/privacy}","received_events_url":"https://api.github.com/users/achinverma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-20T05:03:23Z","updated_at":"2016-07-25T19:52:06Z","closed_at":null,"body":"Hi , i am using your lib to sticky header , i have an Tab layout with 2 fragments and when i try to get data from database in background and try to set adpater in the fragment onCreateView() method , i am getting \r\n\r\n` java.lang.NullPointerException: Attempt to invoke virtual method 'int org.zakariya.stickyheaders.SectioningAdapter.getItemViewType(int)' on a null object reference `\r\n\r\n>  Process: competent.groove.swalok, PID: 28820\r\n>     java.lang.NullPointerException: Attempt to invoke virtual method 'int org.zakariya.stickyheaders.SectioningAdapter.getItemViewType(int)' on a null object reference\r\n>             at org.zakariya.stickyheaders.StickyHeaderLayoutManager.getViewType(StickyHeaderLayoutManager.java:707)\r\n>             at org.zakariya.stickyheaders.StickyHeaderLayoutManager.onLayoutChildren(StickyHeaderLayoutManager.java:183)\r\n>             at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3028)\r\n>             at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2906)\r\n>             at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3283)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)\r\n>             at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)\r\n>             at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1695)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:122)\r\n>             at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)\r\n>             at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1170)\r\n>             at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:814)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)\r\n>             at android.widget.FrameLayout.onLayout(FrameLayout.java:514)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)\r\n>             at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)\r\n>             at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)\r\n>             at android.widget.FrameLayout.onLayout(FrameLayout.java:514)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)\r\n>             at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)\r\n>             at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)\r\n>             at android.widget.FrameLayout.onLayout(FrameLayout.java:514)\r\n>             at android.view.View.layout(View.java:15671)\r\n>             at android.view.ViewGroup.layout(ViewGroup.java:5038)\r\n>             at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)\r\n>             at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)\r\n>             at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)\r\n>             at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)\r\n>             at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)\r\n>             at android.view.Choreographer.doCallbacks(Choreographer.java:580)\r\n>             at android.view.Choreographer.doFrame(Choreographer.java:550)\r\n>             at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)\r\n>             at android.os.Handler.handleCallback(Handler.java:739)\r\n>             at android.os.Handler.dispatchMessage(Handler.java:95)\r\n>             at android.os.Looper.loop(Looper.java:135)\r\n>             at android.app.ActivityThread.main(ActivityThread.java:5254)\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:903)\r\n\r\n\r\n\r\n\r\nin my fragment \r\n\r\n> public class GetStartedFragment extends Fragment{\r\n> \r\n>     RecyclerView recyclerView;\r\n>     PersonalAdapter adapter;\r\n> \r\n>     DatabaseHelper db;\r\n>     Database_Result db_insert;\r\n>     ProgressDialog pd ;\r\n>     SharedPreferences pref;\r\n> \r\n> \r\n>     @Override\r\n>     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\r\n>         View view = inflater.inflate(R.layout.personal_recyclerview, container, false);\r\n> \r\n>         recyclerView = (RecyclerView) view.findViewById(R.id.personal_recycler);\r\n> \r\n>         db = new DatabaseHelper(getActivity());\r\n>         db_insert = new Database_Result(getActivity());\r\n> \r\n>         pref = PreferenceManager.getDefaultSharedPreferences(getActivity());\r\n> \r\n>         adapter = new PersonalAdapter(getActivity());\r\n> \r\n>         try {\r\n>             Thread thread = new Thread(){\r\n>                 @Override\r\n>                 public void run() {\r\n>                     super.run();\r\n> \r\n>                     getActivity().runOnUiThread(new Runnable() {\r\n>                         @Override\r\n>                         public void run() {\r\n>                             pd = ProgressDialog.show(getActivity(), \"\", \"Loading messages...\", true);\r\n>                             pd.setCancelable(false);\r\n>                             pd.setCanceledOnTouchOutside(false);\r\n>                             //bar.setVisibility(View.VISIBLE);\r\n>                         }\r\n>                     });\r\n> \r\n>                     if(db_insert.isTableExists(DatabaseHelper.CALL_TABLE) == false){\r\n>                         boolean table = db_insert.Create_CALL_TABLE();\r\n>                         Log.e(\"-----isTableExists Create_CALL_TABLE-----\", \"=\"+table);\r\n>                     }\r\n> \r\n>                     final List<Sms> lstSms = getAllSms();\r\n> \r\n>                     Log.e(\"==Personal Fragment=lstSms.size=====\", \"\" + lstSms.size());\r\n> \r\n>                     db_insert.Update_DB_FLAG();\r\n> \r\n>                     db_insert.ADD_SMS_DATA(lstSms);\r\n> \r\n>                     try {\r\n>                         db_insert.Insert_CALLOG_DATA(Call_LogUtils.logCallLog(getActivity()));\r\n>                     } catch (Exception e) {\r\n>                         e.printStackTrace();\r\n>                     }\r\n> \r\n> \r\n> \r\n>                         final List<Sms> SmsList = db_insert.getAllSMSList();\r\n>                         Log.e(\"=2==Personal=getAllSMSList===\", \"\" + SmsList.size());\r\n> \r\n> \r\n>                     adapter.setSMS(SmsList);\r\n> \r\n>                     Log.e(\"==setSMS==getAllSMSList===\", \"\" + SmsList.size());\r\n> \r\n>                         getActivity().runOnUiThread(new Runnable() {\r\n>                             @Override\r\n>                             public void run() {\r\n> \r\n>                                 recyclerView.setLayoutManager(new StickyHeaderLayoutManager());\r\n> \r\n>                                 recyclerView.setAdapter(adapter);\r\n> \r\n>                                 pd.dismiss();\r\n> \r\n>                             }\r\n>                         });\r\n> \r\n>                 }\r\n>             };\r\n>             thread.start();\r\n>         } catch (Exception e) {\r\n>             e.printStackTrace();\r\n>             //bar.setVisibility(View.GONE);\r\n>             pd.dismiss();\r\n>         }\r\n> \r\n> \r\n>         return view;\r\n>     }"},"comment":{"url":"https://api.github.com/repos/ShamylZakariya/StickyHeaders/issues/comments/235064344","html_url":"https://github.com/ShamylZakariya/StickyHeaders/issues/18#issuecomment-235064344","issue_url":"https://api.github.com/repos/ShamylZakariya/StickyHeaders/issues/18","id":235064344,"user":{"login":"ShamylZakariya","id":1743604,"avatar_url":"https://avatars.githubusercontent.com/u/1743604?v=3","gravatar_id":"","url":"https://api.github.com/users/ShamylZakariya","html_url":"https://github.com/ShamylZakariya","followers_url":"https://api.github.com/users/ShamylZakariya/followers","following_url":"https://api.github.com/users/ShamylZakariya/following{/other_user}","gists_url":"https://api.github.com/users/ShamylZakariya/gists{/gist_id}","starred_url":"https://api.github.com/users/ShamylZakariya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShamylZakariya/subscriptions","organizations_url":"https://api.github.com/users/ShamylZakariya/orgs","repos_url":"https://api.github.com/users/ShamylZakariya/repos","events_url":"https://api.github.com/users/ShamylZakariya/events{/privacy}","received_events_url":"https://api.github.com/users/ShamylZakariya/received_events","type":"User","site_admin":false},"created_at":"2016-07-25T19:52:06Z","updated_at":"2016-07-25T19:52:06Z","body":"Can you make me a simple project that reproduces the bug? It would help."}}
{"actor":{"display_login":"ShamylZakariya"}}