Java: Library koushikdutta.ion.Ion returning empty

1

// RegisteredActive.java
                    package br.com.xxxxxxx.chatbycelso;

                import android.os.Bundle;
                import android.support.v7.app.AppCompatActivity;
                import android.support.v7.widget.Toolbar;
                import android.view.View;
                import android.widget.Button;
                import android.widget.EditText;
                import android.widget.Toast;


                import com.google.gson.JsonObject;
                import com.koushikdutta.async.future.FutureCallback;
                import com.koushikdutta.ion.Ion;


                public class CadastroActivity extends AppCompatActivity {

                    @Override
                    protected void onCreate(Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                        setContentView(R.layout.activity_cadastro);
                        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                        setSupportActionBar(toolbar);

                        Button btn = (Button)findViewById(R.id.btnCadastrar);

                        btn.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {

                                EditText txtCadNome   = (EditText)findViewById(R.id.txtCadNome);
                                EditText txtCadLogin  = (EditText)findViewById(R.id.txtCadLogin);
                                EditText txtCadEmail  = (EditText)findViewById(R.id.txtCadEmail);
                                EditText txtCadSenha  = (EditText)findViewById(R.id.txtCadSenha);
                                EditText txtCadSenha2 = (EditText)findViewById(R.id.txtCadSenha2);

                                String URL;
                                URL = "http://meu_servidor_web/teste/inserir_user.php";

                                Ion.with(getBaseContext())
                                        .load(URL)
                                        .setBodyParameter("nome_usu", txtCadNome.getText().toString())
                                        .setBodyParameter("login_usu", txtCadLogin.getText().toString())
                                        .setBodyParameter("email_usu", txtCadEmail.getText().toString())
                                        .setBodyParameter("senha_usu", txtCadSenha.getText().toString())
                                        .asJsonObject()
                                        .setCallback(new FutureCallback<JsonObject>() {
                                            @Override
                                            public void onCompleted(Exception e, JsonObject result) {

                                                if (result.get("retorno").getAsString().equals("YES")) {

                                                    Toast.makeText(getBaseContext(), "Cadastro Realizado com Sucesso!!!", Toast.LENGTH_LONG).show();
                                                }

                                            }
                                        });
                            }
                        });

                    }

                }
    
asked by anonymous 05.11.2017 / 19:19

0 answers