c# - Cast exception starting action mode in Xamarin Droid -
i'm having problem in xamarin droid app:
i have appcompatactivity fragment. fragment has recyclerview , item template linearlayout textview.
i handle long tap on recyclerview (inside fragment) , handler (minus not related code) is
private void onlistitemselect(int position) { if (_actionmode == null) { try { _actionmode = (activity appcompatactivity).startsupportactionmode(this); } catch (exception ex) { toast.maketext(activity, ex.message, toastlength.long).show(); } } }
the problem when try start action mode (same issue startactionmode()
instead of startsupportactionmode()
) exception:
java.lang.classcastexception: android.support.v7.widget.fitwindowsframelayout cannot cast android.support.v7.widget.viewstubcompat
i can't seem find error , don't understand cause. ideas?
i attach other code snippets.
activity:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <include android:id="@+id/toolbar" layout="@layout/app_bar" /> <framelayout android:id="@+id/frame" android:layout_width="match_parent" android:layout_height="match_parent" /> </linearlayout>
fragment:
<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.recyclerview android:id="@+id/monthlist" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/button_material_light" /> </framelayout>
Comments
Post a Comment