-11

I recently asked the following question on Stack Overflow: How to make a neutral button in AlertDialog and share

That question received a downvote, but I don't understand why. What was the problem with that question? How was it unclear? Was I asking it incorrectly?

How can I improve my question to avoid downvotes in the future?

3
  • 9
    So... typing "Attempt to invoke virtual method on a null object reference" on Google gets me this stackoverflow.com/questions/27420945/…, which quickly points me to this stackoverflow.com/questions/218384/…. Did you do that work before coming to Stack? (not meant as dismissive. Genuine question)
    – Patrice
    Feb 6, 2020 at 18:58
  • @Patrice I typed in Google other requests. At the time when I wrote the question on the stack, I did not know the subtle cause of the problem and could ask Google incorrectly. Thank you for your advice Feb 7, 2020 at 6:20
  • 3
    i mean.... Theres nothing subtle about googling the error you get. To get a good stack reception a certain amount of research is expected. I personally keep my questions in draft a couple of days. I spend these days researching, polishing, improving my question (all in an attempt to fix it). 95% of the time that research fixes my issue.
    – Patrice
    Feb 7, 2020 at 11:31

1 Answer 1

11

Some history:

NullPointerExceptions are generally downvoted as they mostly relate to simply not initiating something. The community got worn down by scouring through millions of users "find where I didn't initiate X" questions and created a canonical to point to which can guide you to finding what was null instead of being instantiated.

Whether this is proper or not can be up for discussion, but for the most part, that is why NullPointerException questions get downvoted.

As for your specific question,

What was the problem with that question? How was it unclear? Was I asking it incorrectly? How can I improve my question to avoid downvotes in the future?

Your question was fairly well written, and in the future I think you will do just fine asking questions. However, the main issue with this current question was that you didn't include which line of the code shown had the error up front (although you do mention it in comments later), as well, you didn't include the needed information of what connected to the line which had the error.

What you should have included was the position of the error, as well the definition of startActivity and any explanation of scoping related to the two. In addition, a screenshot of the debugger paused at the line of error with the value expanded can also help.

By going through these steps, in general, you will probably find that you solve the issue on your own.

3
  • 4
    Additionally, I don't know when the downvote was cast, but the original reversion is this one. Which I'd say is more susceptible to being downvoted than the present one.
    – yivi
    Feb 6, 2020 at 19:39
  • @yivi - Good catch, I hadn't seen that. I agree.
    – Travis J
    Feb 6, 2020 at 20:22
  • Thank you for your advice. I am new to development and on the stack. Your answer will help me a lot in the future. Feb 7, 2020 at 6:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .