1
I have a formulariohelper which obtains the value of Spinners
and save to the bank, but I can’t load the value of the bank into Spinners. Like I set the value?
public Aluno getAluno(){
aluno.setNome(nome.getText().toString());
Log.i(TAG,"helper: "+ aluno.getNome());
aluno.setSobrenome(sobrenome.getText().toString());
Log.i(TAG,"helper: "+ aluno.getSobrenome());
aluno.setEmail(email.getText().toString());
Log.i(TAG,"helper: "+ aluno.getEmail());
//aqui ele pegar o valor da spinner
aluno.setSexo(sexo.getOnItemSelectedListener().toString());
Log.i(TAG,"helper: "+ aluno.getSexo());
aluno.setEmpresa(empresa.getSelectedItem().toString());
Log.i(TAG,"helper: "+ aluno.getEmpresa());
aluno.setNit(nit.getText().toString());
Log.i(TAG,"helper: "+ aluno.getNit());
aluno.setDatanascimento(datanascimento.getText().toString());
Log.i(TAG,"helper: "+ aluno.getDatanascimento());
aluno.setAltura(altura.getText().toString());
Log.i(TAG,"helper: "+ aluno.getAltura());
aluno.setPeso(peso.getText().toString());
Log.i(TAG,"helper: "+ aluno.getPeso());
aluno.setImc(imc.getText().toString());
Log.i(TAG,"helper: "+ aluno.getImc());
return aluno;
}
public void setAluno(Aluno aluno){
nome.setText(aluno.getNome());
Log.i(TAG,"Helper setAluno: "+ aluno.getNome());
sobrenome.setText(aluno.getSobrenome());
Log.i(TAG,"Helper setAluno: "+ aluno.getSobrenome());
//aqui ele seta o valor pra carregar mas nao consegue
sexo.setTag(aluno.getSexo());
Log.i(TAG,"Helper setAluno: "+ aluno.getSexo());
empresa.setTag(aluno.getEmpresa());
email.setText(aluno.getEmail());
Log.i(TAG,"Helper setAluno: "+ aluno.getEmail());
Log.i(TAG,"Helper setAluno: "+ aluno.getEmpresa());
datanascimento.setText(aluno.getDatanascimento());
Log.i(TAG,"Helper setAluno: "+ aluno.getDatanascimento());
nit.setText(aluno.getNit());
Log.i(TAG,"Helper setAluno: "+ aluno.getNit());
You want to know how to set the selected item in the Spinner?
– André Ribeiro
you mean through setOnItemSelectedListener?
– peterson
I don’t understand. What exactly do you want to do?
– André Ribeiro
I want to take a value from the bank and press the spinner.
– peterson
I don’t understand what your problem is.
– Jorge B.