Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Proper way to update the tableview's section's content?

$
0
0

I'm doing this:

Xamarin.Forms.Device.BeginInvokeOnMainThread (() =>
        {
            CitiesSection.Clear ();
            TerminalsSection.Clear ();
            CitiesSection.Add (PlacesVM.Cities.ConvertAll<TextCell> ((c) => new TextCell{ Text = c.Name }));
            TerminalsSection.Add (PlacesVM.Terminals.ConvertAll<TextCell> ((t) => new TextCell {
                Text = t.Name,
                Detail = t.City
            }));
        });

and getting this error:

java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView(-1, class android.widget.ListView) with Adapter(class xamarin.forms.platform.android.TableViewModelRenderer)]
[MonoDroid] at android.widget.ListView.layoutChildren(ListView.java:1555)
[MonoDroid] at android.widget.AbsListView.onTouchUp(AbsListView.java:3617)
[MonoDroid] at android.widget.AbsListView.onTouchEvent(AbsListView.java:3429)
[MonoDroid] at android.view.View.dispatchTouchEvent(View.java:7706)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2210)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1945)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at xamarin.forms.platform.android.PlatformRenderer.n_dispatchTouchEvent(Native Method)
[MonoDroid] at xamarin.forms.platform.android.PlatformRenderer.dispatchTouchEvent(PlatformRenderer.java:62)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
[MonoDroid] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
[MonoDroid] at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2068)
[MonoDroid] at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1515)
[MonoDroid] at android.app.Activity.dispatchTouchEvent(Activity.java:2458)
[MonoDroid] at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2016)
[MonoDroid] at android.view.View.dispatchPointerEvent(View.java:7886)
[libc] Fatal signal 6 (SIGABRT) at 0x00000838 (code=-6), thread 2104 (pXForms.Android)


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>