-1

I'm developing an app where I want to show total subscribers of a YouTube channel using JSON, AsyncTask, TextView. I don't know how to parse a JSON data. Please help me!

My problem has been solved HERE

The JSON API link HERE

https://www.googleapis.com/youtube/v3/channels?part=statistics&id=UCtjgLjaefEi4kcWBl5rpoZg&fields=items/statistics/subscriberCount&key=AIzaSyBU_oWEIULi3-n96vWKETYCMsldYDAlz2M

The JSON file itself

JSON file

JSON.java class

public class JSON extends AsyncTask<String, String, JSONObject> {

    String link = "https://www.googleapis.com/youtube/v3/channels?part=statistics&id=" +
            "UCtjgLjaefEi4kcWBl5rpoZg&fields=items/statistics/subscriberCount&key=AIzaSyBU_oWEIULi3-n96vWKETYCMsldYDAlz2M";

    @Override
    protected void onPreExecute() {
        super.onPreExecute();

    }

    @Override
    protected JSONObject doInBackground(String... args) {

        return null;
    }

    @Override
    protected void onPostExecute(JSONObject json) {

    }
}

My main activity

TextView tv;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tv = (TextView) findViewById(R.id.textView);
}

I desperately need some help, please don't avoid this question!

ArghadipDasCEO
  • 177
  • 1
  • 12

1 Answers1

1

A simple Google would have yielded you the guidance you needed. There's an Android JSON Parsing Tutorial in Android Hive. Also check this SO post for more info.

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
  • 1
    Thanks a **LOT** man!! [Android Hive's tutorial](https://www.androidhive.info/2012/01/android-json-parsing-tutorial/) worked like a charm! – ArghadipDasCEO Feb 13 '18 at 15:11