question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullPointerEx in example app

See original GitHub issue

Hi @lisawray
I tried today for the first time the example app and it keeps crashing on the newly added onClickListener code with this stacktrace:

java.lang.NullPointerException: Attempt to invoke interface method ‘void com.genius.groupie.OnItemClickListener.onItemClick(com.genius.groupie.Item, android.view.View)’ on a null object reference at com.genius.groupie.ViewHolder$1.onClick(ViewHolder.java:22)at android.view.View.performClick(View.java:5637)at android.view.View$PerformClick.run(View.java:22429)at android.os.Handler.handleCallback(Handler.java:751)at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Debugging show me that in this piece of code: if (getAdapterPosition() != NO_POSITION) { onItemClickListener.onItemClick(getItem(), v); }
onItemClickListener it’s always null. At first, I thoughts it was an error in the ViewHolder bind method but I’m not quite sure now. Before writing this, I tried to find a duplicate issue in the list and it seems not present.Anyway, I could be wrong so…sorry, just in case 😃

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
spectrumIGcommented, Jan 20, 2017

@lisawray I can confirm actually this solved the problem. It’s now working perfectly. @lkishor are u gonna submit a PR for this?

1reaction
lisawraycommented, Mar 21, 2017

Thank you for your patience. I’ve just worked through transferring the library on github with the guys at Genius and will be publishing a new release ASAP under a different package name!

Read more comments on GitHub >

github_iconTop Results From Across the Web

NULL pointer in C - GeeksforGeeks
Some of the most common use cases for NULL are: a) To initialize a pointer variable when that pointer variable hasn't been assigned...
Read more >
Null Pointer in C - Javatpoint
Applications of Null Pointer · It is used to initialize o pointer variable when the pointer does not point to a valid memory...
Read more >
NULL pointer in C - Tutorialspoint
A null pointer is a pointer which points nothing. Some uses of the null pointer are: a) To initialize a pointer variable when...
Read more >
How Null pointer work in C with Examples - eduCBA
Introduction to Null pointers in C. In C programming language, a variable that can point to or store the address of another variable...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
1. Let's consider the below function and look out for scenario causing null pointer exception. · 2. We can also add null check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found