I have never used sharedprefrences
before, now what i want to store a authentication token in sharedprefrences
. This is my code where i am getting user token in hawkerauthToken
which is a string, i want to store this token in sharedprefrences
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, LOGIN_URL, object,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
VolleyLog.v("v_response", response.toString(4));
Log.d("resopnse", response.toString());
hawkerauthToken = String.valueOf(response.get("token"));
Log.d("tokeennnn" , hawkerauthToken);
} catch (JSONException e) {
e.printStackTrace();
}
}