Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setText(java.lang.CharSequence)' on a null object reference at com.example.mentalhealth.diary.onCreate(diary.java:49)
Asked
Active
Viewed 93 times
1 Answers
0
In your diary.java
, @line no:49, in the onCreate()
method, it appears that you are using an object which is not instantiated.
Calling a method on that object (which is just declared , but not instantiated using new classname()
syntax).
if your file is shared , at least the 49th line of your sourcecode, it would be easy to correctly mention .

Peter Csala
- 17,736
- 16
- 35
- 75

Bhaskar Gundu
- 38
- 5