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

ListView exception after Context Actions command

$
0
0

I have problem with listview. There is command on VM that takes me to another page (navigation service is basically NavigationPage.PushAsync). There is no problem when i click 'add' on toolbar, but clicking on context actions throws the exception. It happens only on Android.
Code looks like this

    AddCommand = new RelayCommand(() =>
    {
        _navigationService.NavigateTo("AddItem");
    });

  <ContentPage.ToolbarItems>
    <ToolbarItem Text="Add" Command="{Binding AddCommand}" ></ToolbarItem>
  </ContentPage.ToolbarItems>
  <ListView x:Name="ListViewItems" ItemsSource="{Binding Items}" ItemTapped="ListView_OnItemTapped" >
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
         <ViewCell.ContextActions>
           <MenuItem
              Text="Add" Command="{Binding BindingContext.AddCommand, Source={x:Reference ListViewItems}}"/>
          </ViewCell.ContextActions>
           ...
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>

09-29 08:51:49.395 I/MonoDroid(  367): UNHANDLED EXCEPTION:
09-29 08:51:49.400 I/MonoDroid(  367): System.ArgumentException: 'jobject' must not be IntPtr.Zero.
09-29 08:51:49.400 I/MonoDroid(  367): Parameter name: jobject
09-29 08:51:49.400 I/MonoDroid(  367): at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr) <IL 0x0001f, 0x000c8>
09-29 08:51:49.400 I/MonoDroid(  367): at Android.Views.ActionModeInvoker.Finish () <IL 0x00038, 0x0013f>
09-29 08:51:49.400 I/MonoDroid(  367): at Xamarin.Forms.Platform.Android.CellAdapter.OnActionItemClicked (Android.Views.ActionMode,Android.Views.IMenuItem) <IL 0x0001e, 0x00127>
09-29 08:51:49.400 I/MonoDroid(  367): at Android.Views.ActionMode/ICallbackInvoker.n_OnActionItemClicked_Landroid_view_ActionMode_Landroid_view_MenuItem_ (intptr,intptr,intptr,intptr) <IL 0x0001c, 0x00153>
09-29 08:51:49.400 I/MonoDroid(  367): at (wrapper dynamic-method) object.a3e64c2b-1708-4b07-8091-f8943a9b230f (intptr,intptr,intptr,intptr) <IL 0x0001d, 0x00053>
09-29 08:51:49.410 W/art     (  367): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable

Viewing all articles
Browse latest Browse all 91519

Trending Articles



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