1. Download our Official Android App: Forums for Android!

Apps clear edit text after populate into hashmap

Discussion in 'Android Development' started by mah chong jun, Jun 22, 2016.

  1. mah chong jun

    mah chong jun Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jun 22, 2016

    Jun 22, 2016
    2
    0
    5
    Male
    Code (Text):
    1.  
    2. insert.setOnClickListener(new View.OnClickListener() {
    3.             @Override
    4.             public void onClick(View view) {
    5.                 StringRequest request = new StringRequest(Request.Method.POST, insertUrl, new Response.Listener<String>() {
    6.                     @Override
    7.                     public void onResponse(String response) {
    8.  
    9.                         System.out.println(response.toString());
    10.                     }
    11.                 }, new Response.ErrorListener() {
    12.                     @Override
    13.                     public void onErrorResponse(VolleyError error) {
    14.  
    15.                     }
    16.                 }) {
    17.  
    18.                     @Override
    19.                     protected Map<String, String> getParams() throws AuthFailureError {
    20.                         Map<String,String> parameters  = new HashMap<String, String>();
    21.                         parameters.put("firstname",firstname.getText().toString());
    22.                         parameters.put("lastname",lastname.getText().toString());
    23.                         parameters.put("age",age.getText().toString());
    24.  
    25.                         return parameters;
    26.                     }
    27.                 };
    28.                 requestQueue.add(request);
    29.             }
    30.  
    31.         });
    how to clear firstname after populate in the hashmap.
     

    Advertisement

  2. HeavensSentSword

    HeavensSentSword Well-Known Member
    Rank:
    None
    Points:
    93
    Posts:
    134
    Joined:
    Jan 19, 2016

    Jan 19, 2016
    134
    36
    93
    Male
    try something like this
    Code (Java):
    1. //set text to a empty string
    2. first name.setText("");
    And place this at the end of the function after the requestQueue.add
     

Share This Page

Loading...