locked
Visual Studio Android can not setDrawingCacheEnabled RRS feed

  • Question

  • User193986 posted

    Hi,

    I'm trying to implement below code in my Android app build with Visual Studio 2015,

            private Bitmap GetScreenViewBitmap(View v)
            {
                v.setDrawingCacheEnabled(true);
                v.BuildDrawingCache(true);
                Bitmap b = Bitmap.CreateBitmap(v.GetDrawingCache(true));
    
                v.setDrawingCacheEnabled(false); // clear drawing cache
            }
    

    But Visual Studio returns "error CS1061: 'View' does not contain a definition for 'setDrawingCacheEnabled' and no extension method 'setDrawingCacheEnabled' accepting a first argument of type 'View' could be found (are you missing a using directive or an assembly reference?)"

    Which reference to I have to use?

    Monday, February 20, 2017 3:43 PM

All replies

  • User12817 posted

    You would need to use the regular property: DrawingCacheEnabled = true instead.

    https://developer.xamarin.com/api/property/Android.Views.View.DrawingCacheEnabled/

    More on this here:

    https://developer.xamarin.com/guides/android/advanced_topics/xamarin-for-java/#properties

    Tuesday, February 21, 2017 10:09 PM