Tag: Development

MenuInflater NullPointerException (NPE)

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:

FATAL EXCEPTION: main
java.lang.NullPointerException
	at com.actionbarsherlock.view.MenuInflater.inflate(MenuInflater.java:109)
	at com.test.app.SomeFragment.onCreateOptionsMenu(SomeFragment.java:1921)
	at android.support.v4.app.Watson.onCreatePanelMenu(Watson.java:55)
	at com.actionbarsherlock.ActionBarSherlock.callbackCreateOptionsMenu(ActionBarSherlock.java:559)
	at com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchCreateOptionsMenu(ActionBarSherlockNative.java:65)
	at com.actionbarsherlock.app.SherlockFragmentActivity.onCreatePanelMenu(SherlockFragmentActivity.java:165)
	at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:446)
	at com.android.internal.policy.impl.PhoneWindow.invalidatePanelMenu(PhoneWindow.java:820)
Read more...

Android Tutorial: Implementing a Drag and Sort ListView with a Database

I’m working on an app and got to the point where I wanted to implement a drag and drop ListView that allows re-ordering, adding and deleting of list items using a database. I didn’t think that it would be all that difficult. However, with my limited experience with Android, it turned out to be a bit of a pain to get working. But, now that I have it working I figured I’d post some example code so that others can take advantage of what I learned and hopefully have an easier time getting this implemented.

My initial searches had me stumble upon DragSortListView (DSLV) by Carl A.… Read more...