So I was looking on StackOverflow for the answer on this question but couldn't find one.
I have an URL whose left and right part are always the same, but the part in a middle changes constantly. If there's only one word it works fine, but if there are multiple the URL brokes.
I need to replace all the whitespace with plus (+) sign.
I'm using this code with no luck:
String content = bioObj.getString("summary");
                    content = content.replaceAll(" ", "%20");
                    bio.setText(content);
Can anyone help?
FULL CODE:
String finalUrlBio = bioUrlLeft+title+bioUrlRight;
        JsonObjectRequest bioRequest = new JsonObjectRequest(Request.Method.GET, finalUrlBio, (JSONObject) null, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                try {
                    JSONObject artistObj = response.getJSONObject("artist");
                    JSONObject bioObj = artistObj.getJSONObject("bio");
                    String content = bioObj.getString("summary");
                    content = content.replaceAll("\\s","+");
                    bio.setText(content);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
            }
        });
        AppController.getInstance().addToRequestQueue(bioRequest);
ERROR:
07-01 00:00:37.379 2793-2872/com.darioradecic.topmusicandartists E/Volley: [397649] BasicNetwork.performRequest: Unexpected response code 400 for http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=Red Hot Chili Peppers&api_key=99b9ea4e41463638c76b4759d8b1da1d&format=json
 
    