Method to call the API in fragment class

I want to call API - http://docs.blackberry.com/sampledata.json and show the raw data from API in a Layout file.

I have written the below code in my Fragment class

public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_settings, container, false);

    return rootView;
}

and wrote this in the fragment_settings.xml layout file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical">
    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>

</LinearLayout>

Can someone please help me with populating data in the layout file from API?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.