LaVOZs

The World’s Largest Online Community for Developers

'; java - E/ViewRootImpl: sendUserActionEvent() returned when Implementing ProgressDialog - LavOzs.Com

I'm trying to implement a progressDialog While I'm getting information from the server (using VOlley Library). I get all information from the server and also dismiss the progressDialog but the problem is that I'm getting an error from Android Studio saying "sendUserActionEvent() returned. ":

2020-03-26 16:58:57.239 19869-19869/com.example.clientes E/ViewRootImpl: sendUserActionEvent() returned.

I've tried to follow all posts on website but i have not found whats the reason I'm getting this kind of error, By the way, the application's been tested in Huawey and Samsung and I dont see any negative effect but I'd like to know the reason and solve it to avoid any futher problem it could cause.

Note. When i dont use progressDialog, the error dissapears from Android Studio LogCat, so I assume that something's missing in my code.

This is my whole code.

public class BuscarClientes extends AppCompatActivity implements Response.Listener<JSONObject>, Response.ErrorListener{
    EditText dni;
    TextView nombre;
    TextView profesion;
    Button consultar;
    ProgressDialog progreso;

    RequestQueue rekuest;
    JsonObjectRequest jsonObjectRequest;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_buscar_clientes);

        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);


        this.setTitle("Consultar Clientes");
        //setContentView(R.layout.activity_consultar_clientes);

        dni=(EditText)findViewById(R.id.dni);
        nombre=(TextView)findViewById(R.id.nombre);
        profesion=(TextView)findViewById(R.id.profesion);
        consultar=(Button)findViewById(R.id.button2);

        rekuest= Volley.newRequestQueue(getApplicationContext()); //or use this instead getApplicationContext

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

                if(!TextUtils.isEmpty(dni.getText().toString())){
                    CargarwSDL();
                }
            }
        });
    }

    private void CargarwSDL(){
        //importante colocar en el android manifies application esto:         android:usesCleartextTraffic="true"
        //alternativamente puedes usar esto: <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> en el android manifiest
        //progreso.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        //progreso.show(this,"Buscando Cliente","...Espere unos segundos por favor",false,true);

        progreso=new ProgressDialog(this);    //en lugar de pasar el getApplication context pasar nombre de clase.this o solo this
        progreso.setMessage("...Consultando, por favor espere");
        progreso.setIndeterminate(false);


        progreso.show();
        consultar.setEnabled(false);

        String url="http://192.168.43.41/folder/index.php?id=1&dni="+dni.getText().toString();

        jsonObjectRequest=new JsonObjectRequest(Request.Method.GET,url,null,this,this);
        rekuest.add(jsonObjectRequest);

    }

    @Override
    public void onResponse(JSONObject response) {

        progreso.dismiss();
        //Toast.makeText(getApplicationContext(),"mensaje: "+response,Toast.LENGTH_LONG).show();

        Usuario miUsuario=new Usuario();
        JSONArray json=response.optJSONArray("usuario");
        JSONObject jsonObject=null;

        try {
            jsonObject=json.getJSONObject(0);
            miUsuario.setNombre(jsonObject.optString("nombres"));
            miUsuario.setProfesion(jsonObject.optString("profesion"));
        } catch (JSONException e) {
            e.printStackTrace();
        }
        nombre.setText(miUsuario.getNombre());
        profesion.setText(miUsuario.getProfesion());
        consultar.setEnabled(true);



    }

    @Override
    public void onErrorResponse(VolleyError error) {
        progreso.dismiss();
        Toast.makeText(getApplicationContext(),"No se pudo consultar "+ error.toString(),Toast.LENGTH_LONG).show();
        Log.e("Cabepao_ERROR:",error.toString());
        consultar.setEnabled(true);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu,menu);
        return true;
    }


    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        if(item.getItemId()==R.id.action_settings){

            //Toast.makeText(this, item.getItemId()+"hooola",Toast.LENGTH_LONG).show();
            Intent preferenceIntent=new Intent(this, Configuracion.class);
            this.startActivity(preferenceIntent);
        }

        return true;
    }

}
Related
When to use LinkedList over ArrayList in Java?
“implements Runnable” vs “extends Thread” in Java
Download a file with Android, and showing the progress in a ProgressDialog
Implements vs extends: When to use? What's the difference?
Can't start Eclipse - Java was started but returned exit code=13
Can someone show me a simple working implementation of PagerSlidingTabStrip?
setText on button from another activity android
Adding Social Media Share Logic From Firebase in Android
Search Firestore query don't show data in RecycleView