Android ListFragment的可扩展列表适配器

Android ListFragment的可扩展列表适配器,android,android-fragments,android-activity,Android,Android Fragments,Android Activity,我是Android新手。我已经为联系人示例创建了一个自动生成的列表活动 我有两件事- ContactListActivity.java /** auto generated code /** 在ContactListFragment.java中,我修改了这个方法来设置我的列表 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /***

我是Android新手。我已经为联系人示例创建了一个自动生成的列表活动

我有两件事-

 ContactListActivity.java
 /** auto generated code /**
ContactListFragment.java
中,我修改了这个方法来设置我的列表

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    /*** some code **/
    setListAdapter(new ArrayAdapter<MyContact.Contact>(
            getActivity(),
            android.R.layout.simple_list_item_activated_1,
            android.R.id.text1,
            contactList));
但是我无法通过调用成功设置此适配器

setListAdapter(myAdapter)
它显示编译错误

android.widget.ListAdapter can not be applied to android.widget.SimpleExpandableListAdapter 
我必须做出哪些改变才能使其生效

这是我的
activity\u contact\u list.xml

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:id="@+id/contact_list"
    android:name="com.example.sarvesh.litecontacts.ContactListFragment"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:layout_marginLeft="16dp" android:layout_marginRight="16dp"
    tools:context=".ContactListActivity" tools:layout="@android:layout/expandable_list_content"  />

作为错误:


无法将android.widget.ListAdapter应用于 android.widget.SimpleExpandableListAdapter

表示当前正在扩展
ContactListActivity
类中的
ListActivity
,但将
SimpleExpandableListAdapter
适配器对象传递给
setListAdapter
方法,该方法无效


若要在
ContactListActivity
类中使用可扩展列表扩展而不是
ListActivity

则显示编译错误。
哪个错误?android.widget.ListAdapter无法应用于android.widget.SimpleExpandableListAdapter,请参见以下示例:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:id="@+id/contact_list"
    android:name="com.example.sarvesh.litecontacts.ContactListFragment"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:layout_marginLeft="16dp" android:layout_marginRight="16dp"
    tools:context=".ContactListActivity" tools:layout="@android:layout/expandable_list_content"  />