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

Button with Image again

$
0
0

Hi all
I have some old (XF 1.5) project where I succesfully made working buttons with images (XAML) in PCL library shared with Droid and WP8.1 projects.
Novadays I try to use this code in new application with XF 2.0 and it is not working at all. Problem is images are not found, although stored in Resources/drawable folder of Droid project. I use same PCL library in old and in new projest but updated to XF 2.0.

For test I open ButtonImage example from Xamarin Forms Book Preview (ver 2, Chaper 13), update to XF 2.0 and fix some problems in code (interesting why examples doesnt compiling out of the box) and try to run. Same problem - null reference exception:

12-23 12:41:08.669 E/mono-rt (25690): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
12-23 12:41:08.669 E/mono-rt (25690): at Xamarin.Forms.Platform.Android.ResourceManager.GetId (System.Type type, System.String propertyName) [0x0000d] in :0
12-23 12:41:08.669 E/mono-rt (25690): at Xamarin.Forms.Platform.Android.ResourceManager.IdFromTitle (System.String title, System.Type type) [0x00007] in :0
12-23 12:41:08.669 E/mono-rt (25690): at Xamarin.Forms.Platform.Android.ResourceManager.GetDrawable (Android.Content.Res.Resources resource, System.String name) [0x00006] in :0
12-23 12:41:08.669 E/mono-rt (25690): at Xamarin.Forms.Platform.Android.ButtonRenderer+d__17.MoveNext () [0x00053] in :0

So... How to work with images in Xamarin Forms 2.0 ???


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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