[android-developers] Re: More complex Scrollview example needed.
Sure, I can do this. I am working on implementing a dictionary. The dictionary-database is a file that has an index, where each entry points to a concrete database record. What I do now is to search the index for a word, then get the result that points a database record with the dictionary-data. Well, this record information can simply be displayed. But I want something different (and therefore I ask here). I would like to display the Index (with the words from a to z) in a scrollable fashion starting with the before found index. Consider: Search for "Monkey". Result -> indexPosition = 12345 Move forwards to indexPosition 12344 or Move backwards to indexPosition 12346. This "moving forwards/backwards" from an initial position works in a unit test. There, I start with the last index-entry and move backwards to the beginning. Why it not works with a ListView/ListAdapter is, that this "moving forwards/backwards" is implemented recursively. So, what not works is the default ListView behaviour: Consider: Search for "Monkey". Result -> indexPosition = 12345 Start accessing the dataset at index position 0 That results in a StackOverflow, because of the recursive implementation. I ask myself, what to do now. I can do a simple solution and just displaying what is in the found record and display that. Or to ask, for a working solution that can be scrolled on display through the index. Cheers, Rutton. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: More complex Scrollview example needed.
The thing is, the BaseAdapter providing the info for the ListView does not have a list, it retrieves the items directly from the database, based on an offset. This is needed because the size of this list would be huge (about 10 entries). I have tried it with adding a lookup offset to the position parameter in BaseAdapter:getView(int position,.. ). This results in retrieving appropriate results starting with the search result and propper scrolling through the data records. But with this it is not possible to scroll before that initially added offset. So I am noch lucky with the behaviour yet. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: More complex Scrollview example needed.
Hello, On 7 Nov., 17:01, Kostya Vasilyev wrote: > Another is to use a count query for the word, to find out its position > within the dictionary, and then setting the list view's position based on > that. This assumes that you feed the entire dictionary to the list view. I worked on it in the meantime. And I used the easier solution with just displaying the results. But this above solution interests me. My database backend just knows (to some degree) where records are in the record table. But... you say, that its posible to set the list views position. I haven't seen anything else than smoothScroll in the ListView API and thats too slow. So, I have something working that delivers acceptable results (with a simpler result output - with no full scrolling through the database), and thats enough for now. Cheers, R. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: More complex Scrollview example needed.
On 9 Nov., 23:53, Kostya Vasilyev wrote: > You could try ListView methods: setSelection, setSelectionFromTop. > > Not sure how well they work with cursor based adapters, but running some > tests is probably worthwhile.. setSelection does what it says. It is possible to jump right into the middle of the list. Thanks a lot for this info. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: More complex Scrollview example needed.
Umm, have you tried adding elements to the top/bottom of the list when the user starts scrolling up or down? That should work. And initially, query and fetch, say, 10 results from your DB based on the "search string". And keep adding elements to the top or bottom of the list accordingly. On Sun, Nov 7, 2010 at 5:06 AM, Rutton wrote: > Sure, I can do this. I am working on implementing a dictionary. The > dictionary-database is a file that has an index, where each entry > points to a concrete database record. What I do now is to search the > index for a word, then get the result that points a database record > with the dictionary-data. Well, this record information can simply be > displayed. But I want something different (and therefore I ask here). > I would like to display the Index (with the words from a to z) in a > scrollable fashion starting with the before found index. > > Consider: Search for "Monkey". > Result -> indexPosition = 12345 > Move forwards to indexPosition 12344 > or > Move backwards to indexPosition 12346. > > This "moving forwards/backwards" from an initial position works in a > unit test. There, I start with the last index-entry and move backwards > to the beginning. Why it not works with a ListView/ListAdapter is, > that this "moving forwards/backwards" is implemented recursively. > So, what not works is the default ListView behaviour: > > Consider: Search for "Monkey". > Result -> indexPosition = 12345 > Start accessing the dataset at index position 0 > That results in a StackOverflow, because of the recursive > implementation. > > I ask myself, what to do now. I can do a simple solution and just > displaying what is in the found record and display that. Or to ask, > for a working solution that can be scrolled on display through the > index. > > Cheers, > Rutton. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: More complex Scrollview example needed.
One thing you could do is: change the cursor query to "where id >= word_id - 10", where word_id is the id of the word the user searched for. Another is to use a count query for the word, to find out its position within the dictionary, and then setting the list view's position based on that. This assumes that you feed the entire dictionary to the list view. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 07.11.2010 18:40 пользователь "Rutton" написал: The thing is, the BaseAdapter providing the info for the ListView does not have a list, it retrieves the items directly from the database, based on an offset. This is needed because the size of this list would be huge (about 10 entries). I have tried it with adding a lookup offset to the position parameter in BaseAdapter:getView(int position,.. ). This results in retrieving appropriate results starting with the search result and propper scrolling through the data records. But with this it is not possible to scroll before that initially added offset. So I am noch lucky with the behaviour yet. -- You received this message because you are subscribed to the Google Groups "Android Developers" group... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: More complex Scrollview example needed.
You could try ListView methods: setSelection, setSelectionFromTop. Not sure how well they work with cursor based adapters, but running some tests is probably worthwhile.. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 10.11.2010 1:47 пользователь "Rutton" написал: Hello, On 7 Nov., 17:01, Kostya Vasilyev wrote: > Another is to use a count query fo... I worked on it in the meantime. And I used the easier solution with just displaying the results. But this above solution interests me. My database backend just knows (to some degree) where records are in the record table. But... you say, that its posible to set the list views position. I haven't seen anything else than smoothScroll in the ListView API and thats too slow. So, I have something working that delivers acceptable results (with a simpler result output - with no full scrolling through the database), and thats enough for now. Cheers, R. -- You received this message because you are subscribed to the Google Groups "Android Developers" group... To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this gr... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en