Getting NullPointerException only on few devices while using setAdapter
<p>I am using Vertical <code>ViewPager</code> while using <code>setAdapter</code> i'm checking whether the <code>verticalViewPager</code> and <code>arrayPagerAdapter</code> is <strong>Null</strong> or not but still i'm getting below Logcat exception on <strong>Few Devices</strong> but not in all devices.</p>

<pre><code>Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Handler android.support.v4.app.FragmentHostCallback.getHandler()' on a null object reference
   at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1623)
   at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:637)
   at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
   at com.inheadline.news.view.viewpager.VerticalViewPager.setAdapter(VerticalViewPager.java:278)
   at com.inheadline.news.activity.MainActivity.setupViewPager(MainActivity.java:487)
   at com.inheadline.news.activity.MainActivity.dataAdded(MainActivity.java:557)
   at com.inheadline.news.db.operation.DataSnapshotToDb$AddToDb.onPostExecute(DataSnapshotToDb.java:163)
   at com.inheadline.news.db.operation.DataSnapshotToDb$AddToDb.onPostExecute(DataSnapshotToDb.java:138)
   at android.os.AsyncTask.finish(AsyncTask.java:679)
   at android.os.AsyncTask.access$500(AsyncTask.java:180)
   at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:696)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:150)
   at android.app.ActivityThread.main(ActivityThread.java:5546)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
</code></pre>

<p>Here is my code while setting view pager:</p>

<pre><code>if (verticalViewPager != null &amp;&amp; arrayPagerAdapter != null) {
        verticalViewPager.setAdapter(arrayPagerAdapter);
        verticalViewPager.setSwipable(true);
        verticalViewPager.setOnPageChangeListener(pageChangeListener);
    } 
</code></pre>

<p>In above code <code>MainActivity.java:487</code> is <code>verticalViewPager.setAdapter(arrayPagerAdapter);</code></p>