Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointerException in DatePickerDialog  RSS feed

 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my DatePickerDialog code.



exception is below.


as show in above exception line is
btnSelectDate.setText("Date selected : " + day + "-" + month + "-"
anyway i have already initialize the button.

btnSelectDate = (Button) findViewById(R.id.btnMyshiftDate);
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liyanage wrote:anyway i have already initialize the button.

btnSelectDate = (Button) findViewById(R.id.btnMyshiftDate);

So what happens if that code returns null I wonder? I wonder why that code would return null? Hmm...
 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.its ok now
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!