[Solved] how to a void final with spinner variable that contain string value [closed]


Change

final Spinner spinner = new Spinner(this);

to

final Spinner spinner = (Spinner) findViewById( R.id.spinner1 ); 

Since final variables are tied to the first instance you give them, and you really don’t need to make a Spinner only to find the one you’re looking for. Since you then want to use the Spinner inside an anonymous Listener created inside your method, final is needed.

Also

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); 

Should never be used in my opinion, it defeats the purpose of StrictMode, which forces your code to be a little bit better.

solved how to a void final with spinner variable that contain string value [closed]