Skip to content Skip to sidebar Skip to footer

Checking If Facebook-sdk Android Giving Null Value For User Data Before Calling Getproperty()

I searched I can't find any solution for this problem. I have made graph-request in facebook SDK 3.5. When I try to get data using getProperty('Property_name') and if its value is

Solution 1:

The issue is that you're calling .toString on a potentially null object, and is not really related to the SDK at all. Common java idiom is to protect your calls with null checks. Something like:

Object athletes = user.getProperty("favorite_athletes");
if (athletes != null) {
  map.put("athletes", athletes.toString());
}
...

Post a Comment for "Checking If Facebook-sdk Android Giving Null Value For User Data Before Calling Getproperty()"