I am experiencing a problem with an expandable listview. I want each group to be in the "bond" column, which is non -Enough, but I want the group to be unique (i.e. "bond" should have only one group in each value). Each column in the group has data in the other column, which should be displayed. The problem is that it seems that I can either use the SQL DISTINCT operator with one column (and then retrieve the drivers (IllegalStateException throws), or do not use the DISTINCT operator and duplicate each group. / P>
Can anyone suggest a fix for this?
Public Zero (saved bundle) on {super.onCreate (save); DatabaseHelper DH = New DatabaseHelper (this); dh.openDataBase (); Db = dh.getR EadableDatabase (); String Query = "Choose Direct Bonds from Spectros"; Cursor c = db.rawQuery (Query, Blank); // Exception throws when group is opened / cursor c = db.query ("spectro", new string [ ] {"_id", "name", "bond", ir}, // null, null, null, null, null) - ExpandableListAdapter a = New IRCursorAdapter (this, c, android.r. Layout.simple_expandable_list_item_1, new string [] {"bond"}, new intran [] {android.R.id.text1}, R. Layout.row_doubleend, new string [] {"name", "ir"}, new int [] {R.id.double_item1, R.id.double_item2}}; This.setListAdapter (a); } Protected class IRCursorAdapter SimpleCursorTreeAdapter {public IRCursor adapter (reference reference, cursor cursor, int groupoutout, string [] groupframe, enter [] groupto, int basic layout, string [] childfrom, int [] child to) {super (context, cursor) , Group layout, group, group, child layout, child, child); } @ Override Protected cursor Find the child cursor (cursor group cursor) {cursor c = db.query ("spectro", new string [] {"_id", "name", "bond", "ir"}, "bond = ? ", New string [] {groupCursor.getString (0)}, blank, empty, empty;); StartManagingCursor (c); Return c; }};
Here looks like my desk - The bond is that I want to be unique:
_id | Name | Bandhan | IR
1 | Name 1 Bond 1 ER1
2 | Name 2 Bond 1 Ir 2
3 | Name 3 Bond 2 | ER3
4 | Name 4 Bond 3 Ir 4
Sorry it's not particularly obvious, but thanks for your help!
I think you are misusing different operators. IT will return only Bond 1, Bond 2, Bond 3 and that's it. To create the correct cursor, you need to create a mixed assemble statement. Do you have an error because you have not correctly specified the children second, I will use the query (instead of the raw query) and specify the parameter there.
e.g. Db.query (true, "spectro", new string [] {"bond"}, empty, zero, ...)
You will also need to make sure that you have a group -> Parameters and children -> right for the parameters!
Comments
Post a Comment