It's the default given from the android documentation. I only changed the url.

This is my error message:

java.lang.StringIndexOutOfBoundsException: length=28; regionStart=1;
regionLength=499
at java.lang.String.substring(String.java:1931)
at com.example.my.app.MainActivity$2.onResponse(MainActivity.java:50)
at com.example.my.app.MainActivity$2.onResponse(MainActivity.java:46)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:60)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

During debugging I see that at

mTextView.setText("Response is: "+ response.substring(0,500));

my message is delivered to me but the textview is never updated and the app crashes.

Specifically, it crashes here inside the Looper.Java file:

finally {
if (traceTag != 0) {
Trace.traceEnd(traceTag);
}

traceTag is 0.

I read that some string bounds are wrong but I cannot find out how to fix it.

java.lang.StringIndexOutOfBoundsException: String length is not long enough
as the string length =28 and you are trying to create a substring with
regionStart(beg)=1; regionLength(end)=499
so this is not possible