• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps clear edit text after populate into hashmap

Code:
insert.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                StringRequest request = new StringRequest(Request.Method.POST, insertUrl, new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {

                        System.out.println(response.toString());
                    }
                }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {

                    }
                }) {

                    @Override
                    protected Map<String, String> getParams() throws AuthFailureError {
                        Map<String,String> parameters  = new HashMap<String, String>();
                        parameters.put("firstname",firstname.getText().toString());
                        parameters.put("lastname",lastname.getText().toString());
                        parameters.put("age",age.getText().toString());

                        return parameters;
                    }
                };
                requestQueue.add(request);
            }

        });

how to clear firstname after populate in the hashmap.
 
try something like this
Java:
//set text to a empty string
first name.setText("");

And place this at the end of the function after the requestQueue.add
 
Back
Top Bottom