2
I’m having trouble finding a code that works.
Below is the code I’m using in Android Studio, this code takes the form information and sends to a php file to save in the database, is working well.
What I need is a code for the Radiobutton information to be registered as well, I am not able to register the String to save in the database.
I have tried several codes but it does not save the value of the radiobutton, whenever it saves the record or saves numbers or saves the word android.widget.radio.
The only way I could save the right information is with the code:
String opcao = rb_make.getText().toString().trim().toLowerCase();
But if I add more options the program only registers the first.
Does anyone know how to make it work properly?
private void registerUser() {
String nome = etNome.getText().toString().trim().toLowerCase();
String email = etEmail.getText().toString().trim().toLowerCase();
String cpf = etCpf.getText().toString().trim().toLowerCase();
String telefone = etTelefone.getText().toString().trim().toLowerCase();
String endereco = etEndereco.getText().toString().trim().toLowerCase();
String cidade = etCidade.getText().toString().trim().toLowerCase();
String estado = etEstado.getText().toString().trim().toLowerCase();
String senha = etSenha.getText().toString().trim().toLowerCase();
String opcao = ?????
register(nome, email, cpf, telefone, endereco, cidade, estado, senha, opcao);
}
private void register(String nome, String email, String cpf, String telefone, String endereco, String cidade, String estado, String senha, String opcao) {
String urlSuffix = "?nome="+nome+"&cpf="+cpf+"&senha="+senha+"&email="+email+"&telefone="+telefone+"&endereco="+endereco+"&cidade="+cidade+"&estado="+estado+"&opcao="+opcao;
class RegisterUser extends AsyncTask<String, Void, String>{
ProgressDialog loading;
Try to take a look at that link, I am without any tool to test, but it seems to me that meets what you need, if that’s right, put as answer.
– mateusalxd