I'm having trouble finding a code that works.
Below is the code I'm using in Android Studio, this code takes the information from the form and sends it to a php file to save to the database, it's working fine.
What I need is a code for the RadioButton information to be registered too, I am not able to register the String to save to the database.
I have tried several codes but do not save the value of the radiobutton whenever you save the record or save numbers or save the word android.widget.radio .
The only way I was able to save the correct 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 one. Does anyone know how I can make it work correctly?
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;