hudomju / android-swipe-to-dismiss-undo

Android swipe-to-dismiss-undo library and sample code
MIT License
240 stars 82 forks source link

Null Pointer Exception when initializing touchListener #2

Closed bvanhou closed 9 years ago

bvanhou commented 9 years ago

I am getting a Null Pointer Exception

SwipeToDismissTouchListener touchListener = new SwipeToDismissTouchListener<>( new RecyclerViewAdapter(recyclerView), new SwipeToDismissTouchListener.DismissCallbacks() { @Override public boolean canDismiss(int position) { return true; } @Override public void onDismiss(RecyclerViewAdapter view, int position) { Users.remove(position); mAdapter.notifyItemRemoved(position); } });

 Caused by: java.lang.NullPointerException
        at com.hudomju.swipe.adapter.RecyclerViewAdapter.getContext(RecyclerViewAdapter.java:19)
        at com.hudomju.swipe.SwipeToDismissTouchListener.<init>(SwipeToDismissTouchListener.java:143)
bvanhou commented 9 years ago

Resolved. Programming issue with the initalization of the Adapter