Cannot fix Java null pointer error

前端 未结 4 790
悲哀的现实
悲哀的现实 2021-01-29 06:19

I have some code that when I run it returns a null pointer error. This is the code and error from the logcat:

import android.support.v7.app.AppCompatActivity;
im         


        
4条回答
  •  不要未来只要你来
    2021-01-29 06:45

    The problem is this line:

    !textViewString.equals()
    

    Because you've not given the value to the textViewString anywhere before using it. Assign it to an empty string at least, or simply delete that line since at the moment it's not doing you much good, I don't really get it's point. Since you're nowhere changing it's value, none of your buttons will work (even without the exception).

提交回复
热议问题