Could not activate JNI Handle RRS feed

  • Question

  • User43840 posted

    Hi! I want to customize viewpager to make it work vertically. But when setting contentview app cannot create an instance of it and give this error:

    System.NotSupportedException: Could not activate JNI Handle 0xeab00029 (key_handle 0x41357db0) of Java type 'md5b3f8461ca967df4f0978d2e01bf012d6/VViewPager' as managed type 'App3.Widgets.VViewPager'.

    The custom viewpager:

    namespace App3.Widgets
        public class VViewPager : ViewPager
            public VViewPager(Context c) : base(c) { Initialize(); }
            public VViewPager(Context c, Android.Util.IAttributeSet attrs) : base(c, attrs) { Initialize(); }
            public VViewPager(IntPtr jr, JniHandleOwnership transfer) : base(jr, transfer) { Initialize(); }
            private void Initialize()
                SetPageTransformer(true, new VerticalPageTransformer());
                OverScrollMode = OverScrollMode.Never;
            private MotionEvent SwapXandY(MotionEvent ev)
                ev.SetLocation(ev.GetY() / Height * Width, ev.GetX() / Width * Height);
                return ev;
            public override bool OnInterceptTouchEvent(MotionEvent ev) => base.OnInterceptTouchEvent(SwapXandY(ev));
            public override bool OnTouchEvent(MotionEvent ev) => base.OnTouchEvent(SwapXandY(ev));
            private class VerticalPageTransformer : IPageTransformer
                //some codes for changing behavior
    Thursday, July 13, 2017 7:48 AM


All replies

  • User43840 posted

    Answer is provided here : http://stackoverflow.com/a/10603714/748199 Any method that modifies View before it is created can cause this, in my case: Initialize()

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, July 18, 2017 6:09 PM
  • User362958 posted

    Hi, Im having the same issue, What did you have to do to rectify this? Where did you call initialise? Thanks

    Monday, December 11, 2017 11:54 PM
  • User43840 posted

    Hi! I made Initialize() public and I call it in my activity or anywhere that view is found or created.

    Tuesday, December 12, 2017 11:02 AM
  • User362958 posted

    Thanks you are a gent!! Just one other thing did you manage to get the verticalviewpager to slide when swipe up and down rather than left and right?

    Tuesday, December 12, 2017 11:57 AM
  • User362958 posted

    Actually i found it, thanks I never added SwapXandY(ev)

    Tuesday, December 12, 2017 12:01 PM
  • User383347 posted

    1.Install-Package SQLite-Net-PCL 2.in properties of project go to android manifest tab and give read-external-storage and write-external-storage. 3.in constructor of connection class write this code.

        private string dbpath = "";
        private string dbName = "YourDB";
        SQLiteConnection db;
        public FriendManagMent()
            dbpath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

    db=new SQLiteConnection(Path.Combine(dbpath,dbName));

    Wednesday, April 15, 2020 7:32 PM