将sherlockListFragments与上下文操作栏一起使用

时间:2013-01-28 14:09:32

标签: android

我正在使用 sherlockListFragments 来显示来自sqlite数据库的列表。我想使用上下文操作栏删除项目列表来自列表。任何人都会分享我完成您已经知道的任务的步骤......

感谢您的帮助..

1 个答案:

答案 0 :(得分:0)

可以通过编码轻松完成

public void onActivityCreated(Bundle savedInstanceState) {





    TextView textView;
    Log.i("live", "onActivityCreated");
    super.onActivityCreated(savedInstanceState);
    mActionMode=null;

    setEmptyText("Loading...");


    myModeListener=new OnItemClickListener() {




        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position,
                long id) {

            pos[length]=position;




            mActionMode=getSherlockActivity().startActionMode(new mCallBack());
            Log.i("asa",Integer.toString(pos[length]));
            length++;




        }



    };




    myStocksadapter = new SimpleCursorAdapter(getActivity().getApplicationContext(),R.layout.delete, null, new String[] {DBConstants.NAME}, new int[] {android.R.id.text1},0);
    setListAdapter(myStocksadapter);
    mycontext=this;
    //textView=(TextView)findViewById(android.R.id.text1);

    getActivity().getSupportLoaderManager().initLoader(0, null, mycontext);

    Log.i("sss","before action bar");





}