Implement a CursorAdapter, issue with newView
<p>I have created a CursorAdapter but I keep on getting the following error: </p>

<pre><code>06-01 20:36:58.890: E/AndroidRuntime(21204): java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup
</code></pre>

<p>Here is my code:</p>

<pre><code>@Override
public View newView(Context context, Cursor cursor, ViewGroup parent)
{
    final LayoutInflater inflater = LayoutInflater.from(context);

    //***The error originates from this line***
    final View view = inflater.inflate(R.layout.competitor_autocomplete_list_item, parent, false);

    TextView stockNameTextView = (TextView) view.findViewById(R.id.autocomplete_stock_name); 
    TextView stockSymbolTextView = (TextView) view.findViewById(R.id.autocomplete_stock_symbol);        

    String stockName = cursor.getString(cursor.getColumnIndex(StournamentConstants.TblStocks.COLUMN_NAME)); 
    String stockSymbol = cursor.getString(cursor.getColumnIndex(StournamentConstants.TblStocks.COLUMN_EXTERNAL_ID)); 

    stockNameTextView.setText(stockName);
    stockSymbolTextView.setText(stockSymbol);       

    return view;
}
</code></pre>

<p>My Layout:</p>

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

    &lt;TextView
    android:id="@+id/autocomplete_stock_name"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:background="#95B9C7"
    android:padding="10dp"        
    android:textColor="#000"
    android:textSize="16sp" /&gt;

    &lt;TextView
    android:id="@+id/autocomplete_stock_symbol"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:background="#95B9C7"
    android:padding="10dp"        
    android:textColor="#000"
    android:textSize="16sp" /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>I basically wanted to use a LinearLayout with two TextViews but went to using View with two TextViews because I thought this will take care of this error. I tried casting to other types but I am stuck - I don't understand what I am doing wrong here. </p>

<p>Can anyone see what I am missing? Thanks!</p>

<hr>

<p>UPDATE</p>

<p>I changed the layout to use <code>LinearLayout</code>. Now I get the following error: 
    06-02 00:48:15.820: E/AndroidRuntime(32157): java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams</p>

<p>After leaving the following method:</p>

<pre><code>@Override
public void bindView(View view, Context context, Cursor cursor)
{           
    ((LinearLayout) view).addView(view);
}
</code></pre>

<p>This is the printed stack after the Exception is thrown</p>

<pre><code>06-02 00:53:37.031: E/AndroidRuntime(32327): FATAL EXCEPTION: main
06-02 00:53:37.031: E/AndroidRuntime(32327): java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.widget.ListView.measureScrapChild(ListView.java:1163)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.widget.ListView.measureHeightOfChildren(ListView.java:1246)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.widget.ListPopupWindow.buildDropDown(ListPopupWindow.java:1095)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.widget.ListPopupWindow.show(ListPopupWindow.java:524)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1062)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:939)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.widget.AutoCompleteTextView.onFilterComplete(AutoCompleteTextView.java:921)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.os.Looper.loop(Looper.java:137)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at android.app.ActivityThread.main(ActivityThread.java:4424)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at java.lang.reflect.Method.invokeNative(Native Method)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at java.lang.reflect.Method.invoke(Method.java:511)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-02 00:53:37.031: E/AndroidRuntime(32327):    at dalvik.system.NativeStart.main(Native Method)
</code></pre>
