如何将sqlite中的记录ID设置为Navigation Drawer项的position / id

时间:2015-04-10 06:14:39

标签: java android sqlite navigation-drawer

我在sqlite数据库中从我的表的2列中获取了2个数组。

1 - Group ID

2 - Group Name

我希望使用群组名称创建Navigation Drawer,当用户点击每个项目时,我可以从位置/ ID获取Group ID

final SQLiteDatabase mydatabase = openOrCreateDatabase("CopyCollection", MODE_PRIVATE, null);
    Cursor crs = mydatabase.rawQuery("SELECT * FROM Groups WHERE ID != 1",null);
    String[] array = new String[crs.getCount()];
    String[] arrayID = new String[crs.getCount()];
    int i = 0;
    while(crs.moveToNext()){
        String uname = crs.getString(crs.getColumnIndex("GroupName"));
        String id = crs.getString(crs.getColumnIndex("ID"));
        array[i] = uname;
        arrayID[i] = id;
        i++;

现在我有2个阵列,但我不知道如何在导航抽屉中设置

public void onItemClick(AdapterView<?> parent, View view, final int pos, final long id){

0 个答案:

没有答案