ListView using Layout Infleter in android
<p>I am trying to make List View but i get following error can any one tell me the what wrong with my code.</p>

<p>so please help me.</p>

<p>09-28 10:52:28.918: ERROR/AndroidRuntime(383): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
09-28 10:52:28.918: ERROR/AndroidRuntime(383):     at android.app.ListActivity.onContentChanged(ListActivity.java:245)
09-28 10:52:28.918: ERROR/AndroidRuntime(383):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
09-28 10:52:28.918: ERROR/AndroidRuntime(383):     at android.app.Activity.setContentView(Activity.java:1647)
09-28 10:52:28.918: ERROR/AndroidRuntime(383):     at com.unundoinc.FaceBook.Activity.NewsFeedActivity.onCreate(NewsFeedActivity.java:51)
09-28 10:52:28.918: ERROR/AndroidRuntime(383):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-28 10:52:28.918: ERROR/AndroidRuntime(383):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)</p>

<p><em><strong></em>**<em>*</em>**</strong><em>THIS IS MY XML FILE WHICH CONTAIN LIST VIEW <strong></em>**<em>*</em>**<em>*</em>*</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/newsfeedactivity" android:orientation="horizontal"
    android:layout_width="fill_parent" android:layout_height="fill_parent"&gt;

    &lt;ListView android:id="@+id/list" android:layout_width="wrap_content"
        android:layout_height="wrap_content"&gt;
    &lt;/ListView&gt;

&lt;/LinearLayout&gt;
</code></pre>

<hr>

<p><em><strong></em>**<em>*</em>**<em>*</em>***</strong><em>THIS IS MY .JAVA FILE <strong></em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em></strong></p>

<pre><code>public class NewsFeedActivity extends ListActivity
{   
    public ArrayList&lt;UserDetail&gt; mData ;
    private ListView feedbookListView;


    OAuth oauth = new OAuth();  
    public static final String TAG = "NewsFeedActivity";
    public static final String FaceBookURL = "http://graph.facebook.com/";

    private ListAdapter objListAdapter;

    private TextView textMessage = null;
    private ImageView backThumbnail = null;
    private ImageView urlThumbnail = null;

    private String access_token = "";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstance) 
    {
        super.onCreate(savedInstance);
        access_token = getIntent().getExtras().getString("ACCESS_TOKEN");
        setContentView(R.layout.newsfeedactivity);

        // Setting Context of the ThumbnailManager
        ThumbnailManager.context = this;

        feedbookListView = (ListView) findViewById(R.id.list);
        textMessage = (TextView)findViewById(R.id.facebook_text);


        mData = new ArrayList&lt;UserDetail&gt;();
        this.objListAdapter = new ListAdapter(this, R.layout.newsfeedactivitycell, mData);
        setListAdapter(objListAdapter);

        onComplete();

    }
    //////////////////////////////////////////////////////////////////////////////  
    public void onComplete() 
    {       
        Bundle parameters = new Bundle();
        String response = null;

        /*Inserts a String value into the mapping of this Bundle, 
            replacing any existing value for the given key. Either key or value may be null.
         */
        parameters.putString("access_token", access_token);
        //parameters.putString("method", "platform/posts");

        Log.v(TAG, "PARAMETERS  :: "+parameters);
        try
        {
            response = oauth.request( "platform/posts" , parameters);  
            android.util.Log.v(TAG, "RESPONSE :: " + response );
        }
        catch (MalformedURLException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        catch (IOException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        /**
         * To parse the FeedBook using JSON parsing
         */


        try 
        {
            JSONObject temp = new JSONObject(response);
            JSONArray arrayOfJsonObjs = temp.getJSONArray("data");
            Log.v(TAG, "ARRAY SIZE :: " + arrayOfJsonObjs.length());
            UserDetail objUserDetail = new UserDetail();
            for(int i = 0; i&lt; arrayOfJsonObjs.length(); i++)
            {
                try 
                {
                    JSONObject objFromArr = arrayOfJsonObjs.getJSONObject(i);
                    JSONObject objFromObj = objFromArr.getJSONObject("from");

                    if(objFromObj.has("id") == true)
                    {
                        objUserDetail.setUserId(objFromObj.getString("id"));
                    }
                    else
                    {
                        objUserDetail.setUserId("");
                    }

                    if(objFromObj.has("name") == true)
                    {
                        objUserDetail.setUserName(objFromObj.getString("name"));
                    }
                    else
                    {
                        objUserDetail.setUserName("");
                    }

                    if(objFromArr.has("picture") == true)
                    {
                        objUserDetail.setUserStatusImage(objFromArr.getString("picture"));
                    }
                    else
                    {
                        objUserDetail.setUserStatusImage("");
                    }

                    if(objFromArr.has("caption") == true)
                    {
                        objUserDetail.setUserStatus(objFromArr.getString("caption"));
                    }
                    else
                    {
                        objUserDetail.setUserStatus("");
                    }

                    objUserDetail.setUserProfileImageUrl
                    (FaceBookURL+
                            objUserDetail.getUserId()+
                            "/picture"
                    );

                    Log.v
                    (
                            TAG,
                            //" Array Of Json Objects : [" + i+"] is::" + arrayOfJsonObjs.getJSONObject(i)
                            //"ICON URL ["+i+"] is ::"+objFromArr.getString("icon")
                            "OBJECT ["+i+"]"+ "\n"+
                            "Picture URL is ::"+objUserDetail.getUserStatusImage() + "\n"+
                            "This is your id  :: "+objUserDetail.getUserId()+ "\n"+
                            "This is your name ::"+objUserDetail.getUserName()+ "\n"+
                            "This is Status Message ::"+objUserDetail.getUserStatus()+ "\n"+
                            "Profile picture image URL is ::"+objUserDetail.getUserProfileImageUrl()

                    );
                }
                catch (JSONException e) 
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

        catch (JSONException e) 
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    ////////////////////////////////////////////////////////////////////////////

    public class ListAdapter extends ArrayAdapter&lt;UserDetail&gt;
    {
        LayoutInflater inflater;
        private ThumbnailManager objThumbnailManager = new ThumbnailManager();
        private ArrayList&lt;UserDetail&gt; items;

        //private Bitmap back =  null;
        //private Bitmap type = null;


        public ListAdapter(Activity context, int textViewResourceId,ArrayList&lt;UserDetail&gt; items) 
        {
            super(context, textViewResourceId, items);  
            this.items = items;
        }



        @Override
        public View getView(int position, View convertView, ViewGroup parent) 
        {           
            //View row = inflater.inflate(R.layout.newsfeedactivitycell, null);
            View objView= convertView;
            if (objView == null) 
            {
                LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                objView = vi.inflate(R.layout.newsfeedactivitycell, null);
            }

            UserDetail objUserDetail = items.get(position);
            if (objUserDetail != null) 
            {

                textMessage = (TextView)findViewById(R.id.facebook_text);

                if(textMessage != null)
                {
                    textMessage.setText("StatusMessage: "+ objUserDetail.getUserStatus());
                }
            }

            return objView; 

            //          textMessage = (TextView) row.findViewById(R.id.facebook_text);  //id            
            //          //backThumbnail = (ImageView) row.findViewById(R.id.facebook_thumbnail);    //drawable
            //          textMessage.setText(objListAdapter.getItem(position).getUserStatus());          



        }       

    }   
}
</code></pre>
