title: RecycleView using GridLayout
body: <p>I got this exception using recyclingView in a Fragment:</p>
  
  <pre><code>java.lang.NullPointerException
          at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:1764)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at android.view.View.measure(View.java:16497)
          at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1456)
          at android.view.View.measure(View.java:16497)
          at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
          at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)
          at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1109)
          at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)
          at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
          at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
          at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
          at android.view.Choreographer.doCallbacks(Choreographer.java:574)
          at android.view.Choreographer.doFrame(Choreographer.java:544)
          at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
          at android.os.Handler.handleCallback(Handler.java:733)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:136)
          at android.app.ActivityThread.main(ActivityThread.java:5001)
          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:785)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>There is already a solution for this kind of bug:</p>
  
  <pre><code>LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
  layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  recyclerView.setLayoutManager(layoutManager);
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/26737113/java-lang-nullpointerexception-at-android-support-v7-widget-recyclerview-onmeasu">java.lang.NullPointerException at android.support.v7.widget.RecyclerView.onMeasure</a></p>
  
  <p>Using this code everything works as it should but the thing is that I want to use a GridLayout instead.</p>
  
  <pre><code>    GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),3); 
  
  recyclerView.setLayoutManager(gridLayoutManager); ...
  </code></pre>
  
  <p>I have already debugged but GridLayoutManager in not null... </p>
  
  <p>Please I appreciate any help</p>