Saturday, 12 May 2018

java.lang.NullPointerException:attempt to invoke virtual 'void android.widget.TextView.setTest' on a null object refrence in android 2.1.3

I think that you must initialize your TextView.


If you are in activity, put below code in the onCreate method.


TextView myTextView = findViewById(R.id.your_text_view_id);

Or if you are in Fragment, then in onCreateView insert this line:


TextView myTextView = view.findViewById(R.id.text_view_id);

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...