如何在Android Studio中从Json Url获取Json?

如何在Android Studio中从Json Url获取Json?,android,json,Android,Json,我有以下代码从原始文件检索Json: @Override protected RecyclerView.Adapter getAdapter() { if (adapter == null) { String jsonStr = readRawFile(); Gson gson = new Gson(); VideoPage videoPage = gson.fromJson(jsonStr, VideoPage.class);

我有以下代码从原始文件检索Json:

@Override
protected RecyclerView.Adapter getAdapter() {
    if (adapter == null) {
        String jsonStr = readRawFile();
        Gson gson = new Gson();
        VideoPage videoPage = gson.fromJson(jsonStr, VideoPage.class);
        adapter = new VideoAdapter(videoPage);
    }
    return adapter;
}

String readRawFile() {
    String content = "";
    Resources resources = getContext().getResources();
    InputStream is = null;
    try {
        is = resources.openRawResource(R.raw.video_list);
        byte buffer[] = new byte[is.available()];
        is.read(buffer);
        content = new String(buffer);

    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    return content;
}
文件video_list.json:


现在我不想从这个视频列表文件获取Json,我想从包含Json的url获取Json文件。有人能帮我再次编写代码吗?

使用AsyncTask/volley/Reformation你可以复制这个json,粘贴它,然后获取你的url…..然后使用AsyncTask/volley/Reformation试试,你能帮我编写代码吗?谢谢使用AsyncTask/volley/Reformation您可以复制此json,粘贴它,然后获取url…..然后使用AsyncTask/volley/Reformation进行尝试您可以帮我编写代码吗?谢谢
"data": [
{
  "title": "Video 1",
  "imgUrl": "http://example.com/",
  "videoUrl": "http://example.com/",
  "docUrl": "http://example.com/"
},
{
  "title": "Video 2",
  "imgUrl": "http://example.com//",
  "videoUrl": "http://example.com/",
  "docUrl": "http://example.com/"
},