0

I have this URI data

`mari://fitbit#access_token=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0WDVEOEgiLCJhdWQiOiIyMjdTSlkiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3Nfd`

And Im trying to get the access_token from the URI using this method

Intent intent = getIntent();
        Uri data = intent.getData();
        if (data != null){
            Log.d("Test",data.toString());
            Log.d("Access Token is: ", data.getQueryParameter("access_token"));
        }

However it gives me an error java.lang.NullPointerException: println needs a message

What have I done incorrectly to access the query parameter?

Stack trace

enter image description here

Durgpal Singh
  • 11,481
  • 4
  • 37
  • 49
Exceptions
  • 1,174
  • 2
  • 9
  • 28

1 Answers1

0

try this one

Log.d("Test","" + data.toString());
 Log.d("Access Token is: ","" + data.getQueryParameter("access_token"));
Hamza
  • 2,017
  • 1
  • 19
  • 40
  • Im not getting crashes anymore but it shows me Null – Exceptions Sep 05 '16 at 13:01
  • so it work ? if yas then try to add brack point and watch what type of data is coming in data variable – Hamza Sep 05 '16 at 13:07
  • Seems like my access_token is null. How do I access the access_token from this URI? `mari://fitbit#access_token=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0WDVEOEgiLCJhdWQiOiIyMjdTSlkiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3Nfd` Is getQueryParameter the correct way to do it? – Exceptions Sep 05 '16 at 13:11
  • sorry bro , i have no experience with this – Hamza Sep 05 '16 at 13:12