Android: problems with getSelectedItem on a spinner

后端 未结 6 1500
旧时难觅i
旧时难觅i 2021-01-27 00:35

I have a Spinner, and put the selected item in the body of a mail. this is my code:

@Override
protected void onCreate(Bundle savedInstanceState) {
         


        
6条回答
  •  孤独总比滥情好
    2021-01-27 00:49

    It seems that Item is returned with NULL value try to Invoking the method from a null object.

    TheNullPointerException is a RuntimeException and thus, the Javac compiler does not force you to use a try-catch block to handle it appropriately.

    Hope this will help you to solve your issue.

    for further reference visit the link below:- http://examples.javacodegeeks.com/java-basics/exceptions/java-lang-nullpointerexception-how-to-handle-null-pointer-exception/

提交回复
热议问题