title: Xamarin.Forms Grouped List View fails on adding new groups in Android
body: <p>I am using Xamarin.Forms for developing mobile apps for Android and windows Phone.</p>
  
  <p>I have a listview of messages which is bound to an ObservableCollection of groups.  The list groups the messages by day then the messages show in order of the time - pretty standard stuff.</p>
  
  <p>The problem I have now encountered is that in Android - using the <strong>Add</strong> function to add new groups to the ObservableCollection causes an unhandled exception to fire.</p>
  
  <blockquote>
    <p>04-22 13:13:32.404 D/Mono    (19971): DllImport attempting to load:
    '/system/lib/liblog.so'. 04-22 13:13:32.404 D/Mono    (19971):
    DllImport loaded library '/system/lib/liblog.so'. 04-22 13:13:32.404
    D/Mono    (19971): DllImport searching in: '/system/lib/liblog.so'
    ('/system/lib/liblog.so'). 04-22 13:13:32.404 D/Mono    (19971):
    Searching for '__android_log_print'. 04-22 13:13:32.414 D/Mono<br>
    (19971): Probing '__android_log_print'. 04-22 13:13:32.414 D/Mono<br>
    (19971): Found as '__android_log_print'. 04-22 13:13:32.434
    I/MonoDroid(19971): UNHANDLED EXCEPTION: An unhandled exception
    occured.</p>
    
    <p>04-22 13:13:32.444 I/MonoDroid(19971):
    System.ArgumentOutOfRangeException: Argument is out of range. 04-22
    13:13:32.444 I/MonoDroid(19971): Parameter name: index 04-22
    13:13:32.444 I/MonoDroid(19971): at
    System.Collections.Generic.List<code>1&lt;object&gt;.get_Item (int) &lt;0x0007c&gt;
    04-22 13:13:32.444 I/MonoDroid(19971): at
    Cadenza.Collections.OrderedDictionary</code>2,
    Xamarin.Forms.Cell>>.get_Item (int) &lt;0x00063></p>
  </blockquote>
  
  <p>This is not a problem in Windows.  </p>
  
  <p>I can get around this by using the <strong>AddRange</strong> function and simply adding the item I want to add to another "temporary list" first, then add that temporary list to the main Collection - This gets around it but seems a bit of a hack.</p>
  
  <p>Another way would be to do this on the main thread:</p>
  
  <pre><code>Device.BeginInvokeOnMainThread(() =&gt;
  {
     // using of add function in this manner works.
  });
  </code></pre>
  
  <p>Has anyone had a similar problem and have you found a solution to it?</p>
  
  <p>Thanks,</p>