Activity does not open after thread

1

I'm on an Android project and I have an activity that does not open, well starting from my main activity I already have a button that calls another and everything happens as expected I can make the transition from one to another without problems more do not know the that happens with this one that I call more does not appear, I even changed it with the other being called and there it appears, well, we go to the events so that if someone can help me ... I have a WS and in mine main activity two user and password fields, when clicking on the login button I call a thread that will access the WS if I can log in so I will have to call the SynchronizeActivity, this is for the purpose of synchronizing or to import some registers but it does not appear and nor in logcat does something indicate an error. Well a bit of code might explain better.

private void login(String login, String senha) {
    soap = new SoapObject(namespace,METHOD_NAME ); 

    PropertyInfo p1 = new PropertyInfo();
    PropertyInfo p2 = new PropertyInfo();
    p1.setName("Usuario");
    p1.setValue(login);
    p1.setType(String.class);
    p2.setName("Senha");
    p2.setValue(senha);
    p2.setType(String.class);

    soap.addProperty(p1);
    soap.addProperty(p2);

    envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.setOutputSoapObject(soap);
    transporte = new AndroidHttpTransport(URL);

    progress = ProgressDialog.show(MainActivity.this, "Logando", "Aguarde...", true, false);

    Thread th = new Thread(MainActivity.this);
    th.start();
}

@Override
public void run() {

    try {

        transporte.call("", envelope);
        //resposta = (SoapPrimitive) envelope.getResponse();
        objRetorno = envelope.getResponse();

        handler.sendEmptyMessage(0);

    } catch (Exception e) {
        Log.e("Erro", "Erro: "+ e.getMessage());
        finish();
    }

}

private Handler handler = new Handler() {
    @Override
    public void handleMessage(Message msg) {

        progress.dismiss();

        String[] parts = objRetorno.toString().split("#");

        if (Boolean.parseBoolean(parts[0])) {
            edtRetorno.setText("Ok ! "+parts[2]);
            criarsessao(parts);
        } else {
            edtRetorno.setText("Acesso negado! "+parts[1]);
        }

    }
};

Well and to end the method that calls activity

private void criarsessao(String[] dados){
    sessaoUsuario = new SessaoUsuario();

    sessaoUsuario.setUsuario(edtUserName.getText().toString());
    sessaoUsuario.setSenha(edtPassWord.getText().toString());
    sessaoUsuario.setId(Integer.parseInt(dados[1]));
    sessaoUsuario.setNome(dados[2].toString());

    sessaoUsuarioService.criarSessao(sessaoUsuario);

    config = confService.BuscaporId(1);

    if (config.getSinc().toString() == "S"){
        Intent intent = new Intent(MainActivity.this, SincronizarActivity.class);
        startActivity(intent);
    }

}

So if anyone can give me a boost, I appreciate it.

    
asked by anonymous 07.09.2015 / 16:15

0 answers