Parsing Json url using async

前端 未结 5 923
花落未央
花落未央 2021-01-25 23:53

I get exceptions when running this code. I want to parse the url which is an array of json objects:

package com.example.compsci_734t;

import java.io.BufferedRea         


        
5条回答
  •  半阙折子戏
    2021-01-26 00:17

    The error is explanatory itself:

    java.lang.IllegalArgumentException: Illegal character in scheme at index 0

    You need to remove the beginning space character in your URL:

    private static String url = "http://redsox.tcs.auckland.ac.nz/734A/CSService.svc/courses";
    

    Update:

    After you've updated your question, now the problem seems in this line:

    courses = json.getJSONArray(TAG_COURSES);
    

    because you haven't initialized or set the value of courses that's why its giving NullPointerException error.

提交回复
热议问题