Java / Android: get Facebook user information from graphic API and display it in textview

I'm working hard to learn java now, and I've been in-depth learning since Android faceobok API Now, I'm trying to get some information from my graphics data (in this case, friends) and display it in text view It seems rather trivial, but it has always been

JSONObject json_data = null;

    try
    {
        JSONObject response = Util.parseJson(facebook.request("/me/friends",mBundle,"GET")); // Get a friend information from facebook
        JSONArray jArray = response.getJSONArray("data");

        json_data = jArray.getJSONObject(0);
        String name = json_data.getString("name");
        mText.setText(name);

    }
    catch (MalformedURLException e)
    {
        e.printStackTrace();
    }
    catch (JSONException e)
    {
        e.printStackTrace();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    catch (FacebookError e)
    {
        e.printStackTrace();
    }

When I do this, textview won't change. I'm not sure what went wrong

By the way, there is a lack of good Android Facebook API tutorials Most are hundreds of lines of code; I have no energy or patience to consume all this

Solution

Your assertion of "insignificant" is basically correct, but generally speaking, "jumping into the abyss" rarely leads to anything except drowning

I will be the "person" and suggest that you actually have a general understanding and minimum ability of Java before solving other people's APIs Once you know how Java works - "PME"... Properties, methods and events - learning anyone's API will only become a matter of following the right steps

In addition to that, please answer the following questions: 1) received data from your source? 2) What thread are you calling? 3) Any object is null? 4) Any exceptions thrown when viewing the console or log (print these exceptions to the log and the current implementation)?

Moreover, it's not nothing, but if you don't have the time or patience to learn the "how and why" of general API or software development, it will be a long practice for you if work becomes very important

There was only one person who had tried to drink water from the fire pipe before

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>