I got this error by using the ViewPager in the Android Support package. from the Horizontal View Swiping with ViewPager Tutorial
06-19 13:07:25.950: E/Andro
If getItem() in your Adapter returns null that can cause a null pointer exception.
It's a simple solution. I mixed android.app.Fragment and android.support.v4.app.Fragment
hope this helps someone
Just in case anyone doesn't read the comments of passsy's answer, here is a summary of the useful answers:
1) Examine your getItem(int index)
method very closely and look for any logic, scenarios or missing 'break' statements which might cause you to end up with a null
fragment.
2) Check that the count returned by getCount()
matches the number of fragments returned in getItem(int index)
.
3) Examine your imports and ensure you aren't mixing android.app.Fragment
with android.support.v4.app.Fragment