0
The array of players is filled with the dice but gives error in the method setadapter
.
Spinner spinnerJogador1;
ArrayList<JogadorModel> jogadores = jogadorRepository.SelecionarDisponiveis();
dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, jogadores);
// Drop down layout style - list view with radio button
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// attaching data adapter to spinner
spinnerJogador1.setAdapter(dataAdapter);
Hello, probably your spinner is null, please can post the error log ?
– Arthur Stapassoli
@Ultraseven put the Spinner code for easy help! D
– mauricio caserta
07-04 06:39:39.512 4198 4198 E Androidruntime FATAL EXCEPTION: main 07-04 06:39:39.512 4198 4198 E Androidruntime Process: com.mycompany.Marcatimevolei, PID: 4198 java.lang.Runtimeexception: Unable to start activity Log do erro: ComponentInfo{com.mycompany.MarcaTimeVolei/com.mycompany.MarcaTimeVolei.MontarDuplaActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Spinner.setAdapter(android.widget.SpinnerAdapter)' on a null Object Reference
– UltraSeven
Hello @Arthurcordovastapassoli, the error log is in the previous comment.
– UltraSeven
Hello @mauriciocaserta. The code is complete, I have not yet entered the code to capture the user’s choice.
– UltraSeven
@Ultraseven referred to the code referring to the "spinnerJogador1", could paste the code in which it assigns value to this variable?
– mauricio caserta
@Ultraseven verified in debug whether the variable spinnerJogador1 is null ?
– Arthur Stapassoli
I entered the spinner declaration in the question.
– UltraSeven
@Rthur spinner is null.
– UltraSeven