public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
ContextMenuInfo info = item.getMenuInfo();
AdapterView.AdapterContextMenuInfo contextMenuInfo = (AdapterContextMenuInfo)info;
int position = contextMenuInfo.position;
mPath = mData.get(position).get("path").toString();
switch(item.getItemId()) {
case 0:
Intent intent = new Intent(MyService.PLAY_ACTION);
intent.setComponent(component);
intent.putExtra("path", mPath);
startService(intent);
break;
case 1:
Intent intent1 = new Intent(MyService.PAUSE_ACTION);
intent1.setComponent(component);
startService(intent1);
break;
}
return super.onContextItemSelected(item);
}
长按ListView获取选中的项信息
最新推荐文章于 2016-12-30 15:43:44 发布