i have the following method inside mainActivity but i am trying to move it to separate class file so i can call it in other activities
public void addUser(){
StringRequest stringRequest = new StringRequest(Request.Method.POST,
constants.register_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(getApplicationContext(), response ,Toast.LENGTH_LONG).show();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), error.getMessage() ,Toast.LENGTH_LONG).show();
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params = new HashMap<>();
params.put("username", "value");
params.put("email", "value");
params.put("password", "value");
return params;
}
};
requestHandler.getInstance(this).addToRequestQueue(stringRequest);
}
i have created a class called 'aqlCalls' and tried to put this and other methods inside but i can't figure how to do that.. any help appreciated..