I just recently published my first app on Google Play,¬†and after I had published it I was playing with it on my Galaxy S3 and it crashed when I tried to delete a page. I know I had this working correctly on my Nexus 7 prior to publishing it, but I didn’t test it on my phone (shame on me :(). So, I went to work trying to figure out what the problem was, and here’s part of the stack trace:

After checking the stack trace and doing some research, I narrowed it down to an issue with setHasOptionsMenu(true) and I thought it might be a problem with the ActionBarSherlock Library. Well, I stumbled upon this post and found that setHasOptionsMenu(true) was set in onActivityCreated(). I had set it in onCreate(), since when I had looked at how to use it that’s where everyone seemed to put it…at least in the posts I looked at. Well, it was already broken, so I had nothing to lose and the other stuff I had tried didn’t fix it. I moved setHasOptionsMenu(true) from onCreate() to OnActivityCreated() and then ran a test. Bingo! That fixed the problem on my phone! I tested on my other two tablets (Nexus 7 and Motorola Xoom) and it worked like it should on both of those as well.

Anyway, just throwing this out there in case anyone else runs into this problem.