Skip to content
Advertisement

How to access json array in url that needs bearer token and display in android studio?

Hello stackoverflow community!!

How do I access a JSON array in this URL “https://api.json-generator.com/templates/z0aMAeTBHKq3/data”

token is “2oof0bzpgllll2a8k2fmmh6aaykeu8yptztdzke7”

but when I display the data in an Activity, it just displays blank and exits the app. But When I change the URL without an auth/bearer token I can see the displayed data in the URL.

So my question: is how do I put the token in header so that I can have access and see the data displayed in the mobile phone?

I know it is simple but i am having a hard time.

This is my MainActivity.java

JavaScript

this is my Movie.java

JavaScript

this is my MovieAdapter.java

JavaScript

This is my VolleySingleton.java

JavaScript

Advertisement

Answer

Try This

Change

JavaScript

To

JavaScript

put your headers code inside getHeaders() @Overtide method

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement