Android - Set e Get Conversion -
when trying run method "set" in fields 'setrm,setcpf,setpermissao' shows error:
"the method setrm(integer) in type usuariovo not applicable arguments (string)"
usuariovo vo = new usuariovo(); vo.setrm(txtrm.gettext().tostring()); vo.setcpf(txtcpf.gettext().tostring()); vo.setcargo(txtcargo.gettext().tostring()); vo.setcurso(txtcurso.gettext().tostring()); vo.setsenha(txtsenha.gettext().tostring()); vo.setpermissao(txtpermissao.gettext().tostring());
here code usuariovo:
package br.info.vo;
public class usuariovo {
private integer rm; private integer cpf; private string cargo; private string curso; private string senha; private integer permissao; public integer getrm() { return rm; } public void setrm(integer rm) { this.rm = rm; } public integer getcpf() { return cpf; } public void setcpf(integer cpf) { this.cpf = cpf; } public string getcargo() { return cargo; } public void setcargo(string cargo) { this.cargo = cargo; } public string getcurso() { return curso; } public void setcurso(string curso) { this.curso = curso; } public string getsenha() { return senha; } public void setsenha(string senha) { this.senha = senha; } public integer getpermissao() { return permissao; } public void setpermissao(integer permissao) { this.permissao = permissao; }
}
i believe issue convert 'setrm', 'setcpf', 'setpemissao' of type integer string, how this? please?
you need parse string integer:
vo.setrm(integer.parseint(txtrm.gettext().tostring()));
Comments
Post a Comment