Open faziltm opened 8 years ago
@faziltm please specify for which of the example, you are facing this issue.
I also have a error, please help me its the same UI thread ` public class TareaWSInsercion2 extends AsyncTask<String,Integer,Boolean> {
public Cliente[] listaClientes;
public Boolean doInBackground(String... params) {
boolean resul = true;
final String NAMESPACE = "http://sgoliver.net/";
final String URL="http://10.0.2.2:1473/ServicioClientes.asmx";
final String METHOD_NAME = "NuevoClienteObjeto";
final String SOAP_ACTION = "http://sgoliver.net/NuevoClienteObjeto";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
Cliente cli = new Cliente();
cli.nombre = txtNombre.getText().toString();
cli.telefono = Integer.parseInt(txtTelefono.getText().toString());
PropertyInfo pi = new PropertyInfo();
pi.setName("cliente");
pi.setValue(cli);
pi.setType(cli.getClass());
request.addProperty(pi);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
envelope.addMapping(NAMESPACE, "Cliente", cli.getClass());
HttpTransportSE transporte = new HttpTransportSE(URL);
try
{
transporte.call(SOAP_ACTION, envelope);
SoapPrimitive resultado_xml =(SoapPrimitive)envelope.getResponse();
String res = resultado_xml.toString();
if(!res.equals("1"))
resul = false;
}
catch (Exception e)
{
resul = false;
}
return resul;
}
`
My error is in txtNombre
In android studio the mainactivity.java shows error in doInBackground(String... urls). The setName functions shows the error. i.e Method getText must be called from the UI thread, currently inferred thread is worker less... (Ctrl+F1) .
error in line : 149,150,151 please resolve the error.