-3

I see a run time error at this line of code

TextView textView = (TextView) findViewById(R.id.textView);

textView.setText(message);

exception I am getting,

error:Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference 
Jyoti JK
  • 2,141
  • 1
  • 17
  • 40
  • your textview is not initialized. Please check that you have initialized your view before using it. – Asheesh Feb 10 '18 at 11:56

1 Answers1

0

Have you done setcontentview(R.layout.xxx)?

Either you havent done this or you dont have a view called textView in your layout. You can post more code.

Aykut Karaca
  • 350
  • 3
  • 15