You dont need volley to read a Json file from the asset directory.
In my case, I load an array of Json from the file into my string "filePath".
final String filePath = readFromAsset(act, "json_to_load.json"); //act is my current activity
try {
JSONArray obj = new JSONArray(filePath);
for (int i = 0; i < obj.length(); i++) {
JSONObject jo = obj.getJSONObject(i);
// do stuff
}
} catch (JSONException e) {
e.printStackTrace();
}
In my utils file :
private static String readFromAsset(Activity act, String fileName)
{
String text = "";
try {
InputStream is = act.getAssets().open(fileName);
int size = is.available();
// Read the entire asset into a local byte buffer.
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
text = new String(buffer);
} catch (IOException e) {
e.printStackTrace();
}
return text;
}
To be able to use it your have to import the package "org.json;".
Hope it helps !