我有一个从ListActivity继承并使用AndroidAnnotations的活动.虽然.onListItemClick工作正常,但列表项的上下文菜单根本不会显示,甚至.onCreateContextMenu不会被调用,但是.onListItemClick在长时间点击列表项后会触发.这是我的代码:
@OptionsMenu(R.menu.places)
@EActivity(R.layout.places)
public class PlacesPicker extends ListActivity {
private static String[] DATA_SOURCE = { PlacesDB.PLACE_NAME, PlacesDB.PLACE_DESC };
private static int[] DATA_DESTINATION = { R.id.place_name, R.id.place_desc };
public static ListView lv;
@Bean
PlacesDB db;
Cursor cursor;
@AfterInject
public void init() {
cursor = db.getPlaces(null, null);
startManagingCursor(cursor);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.place_item, cursor, DATA_SOURCE, DATA_DESTINATION);
setListAdapter(adapter);
lv = getListView();
registerForContextMenu(lv);
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) …Run Code Online (Sandbox Code Playgroud) 我需要执行一个简单的查询:
SELECT * FROM MyTable WHERE Id IN (:ids)
显然,它返回给定列表中主键“Id”的记录集。如何将整数 ID 数组传递到参数“ids”的 ADOQuery.Parameters 中?我已经尝试过 VarArray - 它不起作用。如果重要的话,参数“ids”默认情况下 FieldType = ftInteger。