2011-07-17 44 views
0

我正在寻找使用本地sqlite数据库的可扩展列表视图教程。从本地Sqlite数据库填充可扩展ListView

我理解到现在是什么,是以下

private class MyTestList extends SimpleCursorTreeAdapter { 

//The below is a constructor with 7 arguments with 3 for parent and 3 for child data ad layout 

public MyTestList (Context ctx, Cursor groupCursor, int groupLayout, 
     String[] groupFrom, int[] groupTo, int childLayout, String[] childFrom, 
     int[] childTo) { 
    super(ctx, groupCursor, groupLayout, groupLayout, groupFrom, groupTo, childLayout, childFrom, childTo); 
} 

我的问题是你如何得到父光标和孩子光标,然后将它们链接到对方。

有一个叫

@Override 
protected Cursor getChildrenCursor(final Cursor groupCursor) { 

    //I suppose here I am passing the parent cursor and then retrieving the 
    //corresponding child cursor for the particular id ?? 

    NOT SURE HOW DO I FILL THIS, I THINK THIS WILL HAVE SOME STRING ARRAY WITH CHILD DATA 
} 

这个API后,我应该与UI绑定它,我该怎么做。一直在寻找很久没有找到东西。

回答

1

在你的getChildrenCursor中创建一个新的游标,就像你为组所做的那样,但是在你的选择中使用WHERE sql语句更加具体!代码示例请参见此PAGE

相关问题