0

Some kind guy gave me an answer to my question by posting code, however it isn't complete from the looks of it. I think its supposed to be a short timed-out kinda function, but it says "Non-static method setRetryPolicy (com.android.volley.RetryPolicy)' cannot be referenced from a static contex" I don't exactly know how to fix this myself, so I'd really appreciate if someone had a quick fix for this. Here is the code;

RegisterRequest registerRequest = new RegisterRequest(username,password,isadmin,responseListener,errorListener);
                int socketTimeout = 500000;//30 seconds - change to what you want
                RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
                StringRequest.setRetryPolicy(policy);
                // Creating RequestQueue.
                RequestQueue queue = Volley.newRequestQueue(CreateUser.this);

                // Adding the StringRequest object into requestQueue.
                queue.add(registerRequest);

It gives that error at in the 4th line. This is also a continuation of my previous questions on trying to make a basic register script in Android Studio. Thanks in advance

1 Answers1

0

I believe it's meant to be

registerRequest.setRetryPolicy()

as that's the StringRequest instance in your code, and then one dealt with further down.

However, you really should just ask the person who posted the answer next time.

TheWanderer
  • 16,775
  • 6
  • 49
  • 63