I'm trying to implement a Xamarin local image on my App, but it's not working - xaml

I'm trying to add a local image in my Xamarin app, but it's not working. Do you know what I could've have missed?
I have added the XAML and c# code but that still does not work.
XAML - <Image x:Name="Background_Image" Source="backgroundimage.png"/>
C# - var image = new Image { Source = "backgroundimage.png" };
I have followed the proper practices to a tee from the Xamarin Images documentation, but it's still not working. Link to Xamarin Documentation on Images - (https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/images?tabs=vswin#Local_Images)
I have made sure the file name is
All in lowercase,
The build action is AndroidResource of the image
The image has been placed in the Resources/drawable folder.
Which are all the conventions you must follow, but it doesn't seem to work.
The image's file size is 1.28mb and resolution is 1920x1080 if that matters. I have tested with a much smaller 4KB image but does not work either.
I am using the Xamarin Live Player to show the app, the phone uses API 19, Android 4.4
I apologise if this is a duplicate, but I have read many topics here but I have not been able to fix it.

It does seem to be a issue or limitation with Xamarin's own Live player. I have launched the App with the Android Emulator and the Image is displaying, I'll report it as a bug.

Related

Xamarin forms Carrousel and take a picture async

I have been trying to replace my carrousel images with t new photos from my phone camera or album, but for some binding reason, they don't display on the carousel.
I am using Xamarin Media Plugin.
any picture I select should display on the carousel. I have been trying everything in here. IMAGE URL works fine, stored images in the resources folder, works as well. but, for some reason display the images from the media is been a nightmare.
You can clone my sample project # GITHUB
I will appreciate Any help.
Looking at the GITHUB project, easy to understand why no relevant code here, it will require the whole sample project. It seems the carousel is not getting updated when uploading an image, binding?? I am still checking.

Xamarin: How do I set a placeholder image in my Image element in XAML?

In Android, it is quite easy to set a image placeholder for development purposes in an imageview.
All one would do is use the tools:src for the placeholder image during development so you could see it in your layout design preview and your actual image you would put into your android:src
. Frequently, you don't set the android:src put would populate that imageview with images that you download off the internet once you connect your app to the net:
<ImageView
android:layout_width="28dp"
android:layout_height="28dp"
android:src=#drawable/activated_icon"
tools:src="#mipmap/white_activated_icon" />
In Xamarin, you have this to display images:
<Image Source="http://lorempixel.com/1920/1080/nature/3" />
Once the app connects, the image is downloaded from the internet and displayed. How do I put in a placeholder image for development purposes (similar to the way you would do it through tools:src in android) so I can see it within the layout design previews?
I'm assuming you want to achieve this with Xamarin Forms, as you referring to XAML in the question title.
Or possibly you are referring to the Xamarin Forms Previewer? In that case, disregard the following answer. You can only use local images in the Previewer as far as I can tell.
Answer in case the question is related to runtime Xamarin Forms
There is no standard option to do this in Xamarin Forms. Take a look at this example suggested by Stephane Delcroix from the Xamarin Forums. The important part of this approach is to stack 2 images on top of each other in a grid. 1 is the placeholder that is placed beneath the image that is being loaded, like this:
var grid = new Grid();
grid.RowDefinitions.Add (new RowDefinition());
grid.Children.Add (image);
grid.Children.Add (placeholderImage);
As an alternative option, WebImage of Xamarin Forms Labs allows an option for a DefaultImage, but I'm not sure if that shows immediately. See this class for the code of the Web Image. Keep in mind that Xamarin Forms Labs is no longer under active maintenance.
Of course you can also write a custom renderer. Maybe based on the Xamarin Forms Labs example.
I use FFImageLoading for this Case.
Just install the Nuget Package and Use the "CachedImage" in XAML.
<ff:CachedImage Source="your url" Placeholder="placeholder while loading"/>
You donĀ“t need to download (and cache) the Image manually then. It will automatically displayed when the download is done.
You can use local files (from Resources or Drawable) and files from HTTP/HTTPS.

Binary is not optimized for iPhone 5 error message for Xcode 6.3

I've read a number of similar Q&As regarding this subject but none have provided me with a working solution.
All my images are PNG.
My deployment target is 8.3 for iPhone.
I'm using Xcode 6.3
I am using an image catalog.
I've tried using -568h in the image name and tried not using it. I tried changing the filename to "Default-568h#2x.png".
I've deleted all images from the image catalog and dragged them back in again.
I've created a new launch images catalog.
No mater what I've done, the same error message appears when I attempt to upload to the App Store:
EDIT:
On the off chance that lacking iPad launch images might have triggered this issue, I also added all launch images for iPad. I also renamed all the image file names, created a new launch image catalog (again) and imported all images. Still getting the same error message.
Resolved the issue but not sure on the exact reason behind it.
The Launch Screen File field had LaunchScreen selected.
The correct selection should have been Main.
This solved the issue and I was able to submit the app without the error message.

Setting ApplicationBarButton.IconUri with icon from Isolated Storage

I am working on windows phone application in which i need to change ApplicationBarButton icon dinamically, for example to show current date like in default Windows Phone Calendar app. Regarding to this article, we can use only png images previously added to solution and reference to them with relative Uri.
It is not a problem for me to generate correct png image (this way and using ToolStack C# PNG Writer Library) and save it to isolated storage, but when i'm initializing AppBarButton with absolute Uri to this image and trying to add it to ApplicationBar, my app throws ArgumentException.
Am i doing something wrong or i just have to draw 366 icons and add them to my project? :)
Thanks in advance!

Has anyone been able to use web images with the Tiles and Badges App sample?

I've been trying to get my app's tile to display an image from the web, but couldn't get it to work. I then tried the Tiles and Badges app sample, where in scenario 3 you can send a tile notification that uses a web image. No matter which image url I paste in the text box, the tile refuses to get updated. So apparently, the sample isn't working either, or something is very wrong.
The images are all smaller than 1024x1024 and less than 200KB. Fun fact: if I download one of the images I unsuccesfully tried to feed the sample, add it to the project and then send a notification using it as a local image, the tile gets updated. So apparently the image isn't the problem.
Has anybody been able to get this working? I don't get what I'm doing wrong.
Do have internet permission ticket in app manifest? Maybe only your app dont have permission to download your image from web.