Android 我得到了一个“答案”;膨胀类片段时出错;?

Android 我得到了一个“答案”;膨胀类片段时出错;?,android,android-fragments,android-listfragment,Android,Android Fragments,Android Listfragment,我有一个主要的活动,它有两个片段,ListFramgment和DetailFragment。 在ListFragment中,在选择一个选项时,我对数据库进行查询,该查询将返回一个数组。我正在将此数组传递给DetailFragment public void onListItemClick(ListView l, View v, int position, long id) { String selectedStore = (String) getListAdapter().getItem

我有一个主要的活动,它有两个片段,ListFramgment和DetailFragment。 在ListFragment中,在选择一个选项时,我对数据库进行查询,该查询将返回一个数组。我正在将此数组传递给DetailFragment

public void onListItemClick(ListView l, View v, int position, long id) {
    String selectedStore = (String) getListAdapter().getItem(position);
    DetailFragment fragment = (DetailFragment) getFragmentManager()
            .findFragmentById(R.id.detailFragment);
    if (fragment != null && fragment.isInLayout()) {
        TestAdapter mDbHelper = new TestAdapter(getActivity());
        mDbHelper.createDatabase();
        mDbHelper.open();

        Cursor curItemList = mDbHelper.getItemList(selectedStore);
        String[] itemList = new String[curItemList.getCount()];
        int i = 0;
        while(curItemList.moveToNext()){
            String item = curItemList.getString(0);
            itemList[i] = item;
            i++;
        }


        mDbHelper.close();

        fragment.setText(itemList);

        //getItemList(selectedStore);



    }
下面是详细的片段代码:

    public class DetailFragment extends android.app.ListFragment {

//   String qty;
//   String pr;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.e("Test", "hello");
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.details, container, false);
        return view;
    }

    public void setText(final String[] itemList) {
        ListView view = (ListView) getView().findViewById(R.id.detailsText);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
                android.R.layout.simple_list_item_1, itemList);
        view.setAdapter(adapter);
}

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        // TODO Auto-generated method stub
        super.onListItemClick(l, v, position, id);
        Toast.makeText(null, "time for popup", Toast.LENGTH_SHORT).show();
    }

检查您的
布局xml文件
第14行

中有错误,在我的情况下,解决方案正在编写中

super.onCreateView(inflater, container, savedInstanceState);
在我的onCreateView实现中

Binary XML file line #14: Error inflating class fragment
super.onCreateView(inflater, container, savedInstanceState);