I'm using following code to get response from the API.
BufferedReader bf = new BufferedReader(new InputStreamReader(
                connection.getInputStream()));
        System.out.println("bf.readLine() - " + bf.readLine());
        output = bf.readLine();
        while (output != null) {
            JSONObject obj = new JSONObject(output);
            System.out.println("output is " + output);
            resCode = obj.getString("resCode");
            resDesc = obj.getString("COUNT");
        }
I can return bf.readLine() response as follows.
{"status":true,"data":[{"COUNT":"0"}]}
Problem is when I assign the bf.readLine() to String and check the value, it becomes null. Why bf.readLine() shows as null (gives null point exception) even it return the value from API.
 
     
     
    