fitnesskim / tree-view-list-android

Automatically exported from code.google.com/p/tree-view-list-android
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

TreeViewAdapter will not allow <String> as type #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

If I extend the AbstractTreeViewAdapter with String Ids instead of Long as in 
your example, Eclipse will not compile my Adapter.

What is the expected output? What do you see instead?

The method "public long getItemId(int position)" must be implemented as a 
Method of android.widget.Adapter. The javadoc of the latter interface expect a 
kind of a row id as long.
If I use Strings as id I don't know how to implement this. The example 
SimpleStandardAdapter from the demo takes the Long (nice coincidence, but not 
requirable).

Is there a better solution for me?

Original issue reported on code.google.com by Cornelia.Schalueck@googlemail.com on 8 Sep 2011 at 11:18

GoogleCodeExporter commented 9 years ago
Honestly - I wanted to make the id type in generic form, but I failed at the 
end :( ..... It turned out that you really need longs as ids because otherwise 
somewhere internally it was needed (I can't remember where now, but I ended up 
giving up on it) . So.... you need to have Longs unfortunately :( and if you 
need Strings you need to have somehow Maps keeping back/forth references.

Original comment by ja...@potiuk.com on 8 Sep 2011 at 2:37