Item reorder - ArrayOutOfBounds Exception

5 posts, 1 answers
  1. Markus
    Markus avatar
    9 posts
    Member since:
    Apr 2015

    Posted 22 Apr 2015 Link to this post

    I am running into the following problem with the Xamarin RadListView component:

    I get an ArrayIndexOutOfBoundsException when reordering an item from one position to a position i have to scroll to.

    For example in a list with 100 items, when i try to reorder item1 to position 50 i get the exception in the ReorderItem(int from, int to) method of the adapter because the from value gets -1. I reproduced this with the cities example (http://docs.telerik.com/devtools/android/controls/listview/behaviors/listview-behaviors-itemreorder) by adding 100 random values to the cities collection.

     Any idea how this can be solved?

    Also: is it possible to reduce the scroll speed within the list?

  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 22 Apr 2015 Link to this post

    Hi Markus,

    Thank you for writing.

    I added 100 items to the list of cities created in the online documentation example and successfully reordered a lot of items including the first to position 50, but I was not able to reproduce an exception. Could you please give more detailed information about the reproduction steps? It would be best if you create a project that demonstrates the issue and send it to us.

    As to the scroll speed... which speed exactly you would like to modify? The speed when you scroll through the list, the speed when a fling gesture occurs, or the scroll speed of the list while in reorder. The first is managed by the layout manager, the second by the recycler view and the third by the ItemReorderBehavior. The last can't be modified with the current implementation, but we can add such a possibility if requested. For the others you need to either extend the layout manager that you are using (for the scroll speed) or RadListView (for the fling speed).

    Regards,
    Todor
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. DevCraft banner
  4. Markus
    Markus avatar
    9 posts
    Member since:
    Apr 2015

    Posted 23 Apr 2015 in reply to Todor Link to this post

    Hi Todor

    Thanks for your fast response. I uploaded a ZIP file with an example Visual Studio Project. The Exception happens in line 59 in the CityAdapter.cs file when reordering an item as described. Take City 1 and reorder it by dragging it to the bottom of the screen. Let it scroll for a second or two and release -> Exception. I use Version 2015.1.306.0 of the Common, Data and List Components.

    Regarding the scroll speed: I want to modify the scroll speed while reordering. It would of course be great if you could add that functionality.

    Cheers from Austria,

    Markus

  5. Answer
    Todor
    Admin
    Todor avatar
    778 posts

    Posted 23 Apr 2015 Link to this post

    Hi Markus,

    Thank you for the sample provided. The reason I was not able to reproduce it was that I was using an older version of the support library. The currently-latest version 22, includes changes in the behavior of the getChildPosition method of RecyclerView, which we need to take into consideration for our implementation. The fixes will be part of the next release of UI for Xamarin which is expected in May. We will also consider the possibility to allow you to control the scroll speed while reordering.

    Regards,
    Todor
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  6. Markus
    Markus avatar
    9 posts
    Member since:
    Apr 2015

    Posted 23 Apr 2015 in reply to Todor Link to this post

    Hi Todor,

    Thank you very much. I'm looking forward to the next release.

    Regards,
    Markus

Back to Top
DevCraft banner