草庐IT

ContextMenuInfo

全部标签

android - onCreateContextMenu 被 ContextMenuInfo 的 null 值调用

我正在尝试使用上下文菜单。我已经使用SimpleCursorAdapter为简单的ListActivity成功完成了此操作。继续我想用CursorAdapter替换SimpleCursorAdapter但仍然保留ContextMenu行为,所以我添加了两个强制覆盖函数bindView和newViewpublicViewnewView(Contextcontext,Cursorcursor,ViewGroupparent){Viewview=mLayoutInflater.inflate(R.layout.check_row,parent,false);registerForContex

java - 使用 Mockito 将参数模拟对象转换为另一个对象

我有一个测试方法,从以下开始:publicvoidonCreateContextMenu(ContextMenumenu,Viewv,ContextMenuInfomenuInfo){AdapterView.AdapterContextMenuInfoinfo=(AdapterView.AdapterContextMenuInfo)menuInfo;contextString=adapter.getItem(info.position);/.../}我想使用Mockito对其进行测试,但是如果我这样声明menuInfo:@MockContextMenuInfomenuInfo那么我不能