Every time I add a png to Visual Studio in our Xamarin.Forms Android project, Visual Studio hangs. Not sure what is causing it, but I didn't have the same issue when adding the first image to the project. I can add images no problem in non-Xamarin apps and also do not have a problem adding it to the share library UI project.
Adding png to Resources\Drawable hangs Visual Studio
is new Xamarin update breaking anything
Asking if anyone has issues with new update?
The root assembly conflicts with another assembly
Hi, after updating my Xamarin for Visual Studio it shows
Severity Code Description Project File Line Suppression State
Error The root assembly /Users/focus/Library/Caches/Xamarin/mtbs/builds/Sample.iOS/f4117d8ec82f837c5c099ce86166d4d3/bin/iPhoneSimulator/Debug/Sample.iOS.exe conflicts with another assembly (/Users/focus/Library/Caches/Xamarin/mtbs/builds/Sample.iOS/f4117d8ec82f837c5c099ce86166d4d3/bin/iPhoneSimulator/Debug/Sample.iOS.exe).
while building the ios project help me for solving this.
Thank you.
HockeyApp - Custom Events on Xamarin.Forms
I have two HockeyApp apps: 1 for iOS and 1 for Android.
I'm implementing custom events in a Xamarin.Forms project, I followed Paulo de Carlo's answer here.
I'm sending the following info to Hockey App from within my PCL Project:
1.- Events without properties
DependencyService.Get<IMetricsManagerService>().TrackEvent( "SomeEvent" );
2.- Events with properties
DependencyService.Get<IMetricsManagerService>().TrackEvent(
AppEvents.EditAccount, // string
new Dictionary<string, string> { { "user", "user_name"} },
new Dictionary<string, double> { { "time", 1.0 } }
);
This is working OK for Android in both cases, with and without properties. However for the iOS project it's only working if I DON'T add properties to the Event. I can't see why.
Here's my code:
IMetricsManagerService.cs:
using System;
using System.Collections.Generic;
namespace MyAppNamespace
{
public interface IMetricsManagerService
{
void TrackEvent(string eventName);
void TrackEvent(string eventName, Dictionary<string, string> properties, Dictionary<string, double> measurements);
}
}
MetricsManagerService.cs (Droid):
using System.Collections.Generic;
using System.Text;
using HockeyApp;
[assembly: Xamarin.Forms.Dependency(typeof(MyAppNamespace.Droid.MetricsManagerService))]
namespace MyAppNamespace.Droid
{
class MetricsManagerService : IMetricsManagerService
{
public void TrackEvent(string eventName)
{
MetricsManager.TrackEvent(eventName);
}
public void TrackEvent(string eventName, Dictionary<string, string> properties, Dictionary<string, double> measurements)
{
MetricsManager.TrackEvent(eventName, properties, measurements);
}
}
}
MetricsManagerService.cs (iOS):
using System;
using System.Collections.Generic;
using System.Text;
using HockeyApp;
[assembly: Xamarin.Forms.Dependency(typeof(MyAppNamespace.iOS.MetricsManagerService))]
namespace MyAppNamespace.iOS
{
class MetricsManagerService : IMetricsManagerService
{
public void TrackEvent(string eventName)
{
MetricsManager.TrackEvent(eventName);
}
public void TrackEvent(string eventName, Dictionary<string, string> properties, Dictionary<string, double> measurements)
{
MetricsManager.TrackEvent(eventName, properties, measurements);
}
}
}
Thanks, any type of help will be appreciated.
How to refresh page, button?
Hello, I have a detailPage, which contains a label with a button, selecting the button makes a call api and returns some data.
How do I make that label show the value? Refresh the page? Thank you.
How to set BindingContext to a page itself?
In regular XAML, it is very straightforward:
DataContext="{Binding RelativeSource={RelativeSource Mode=Self} }
Could anyone offer a tip on how to do it for a Xamarin Forms page?
which folder is images on Wp81 and UWP?
Xamarin documentation says that I should add images directly under the project without any sub folder if I am referring to from XF project but I saw in video on channel9, they were adding images under assets folder? Is there anyway to use subfolders for wp81 and uwp?
Animation / How to fade-out and fade-in images
I have a grid with several images and I would like to change some of the images every 30 seconds.
How can I fade-out and fade-in images similar to jquery .fadeOut(). If not directly possible what is the easiest way to create an smooth image transition from one image to an other?
[Android] ListView ContextAction not following layout
Wondering if anyone else has run into the following issue.
I've got my MainPage wrapped in a navigation page
MainPage = new NavigationPage(new MyPage());
From MyPage
I navigate to a user account page which is a TabbedPage
await Navigation.PushAsync(new MyAccountTabbedPage());
and here's the xaml (pretty simple)
<TabbedPage.Children>
<userAccount:SitesTab />
<userAccount:ProjectsTab />
<userAccount:SettingsTab />
</TabbedPage.Children>
Now here's where it gets fun. From within my SitesTab
, I need to show a ListView
that contains ContextActions
<AbsoluteLayout>
<ListView AbsoluteLayout.LayoutBounds="0,0,1,1"
AbsoluteLayout.LayoutFlags="All"
ItemsSource="{Binding ListItems}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.ContextActions>
<MenuItem Text="Do Stuff"/>
<MenuItem Text="Delete Stuff" IsDestructive="True"/>
</ViewCell.ContextActions>
<StackLayout>
<Label Text="{Binding .}"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</AbsoluteLayout>
The issue I'm running up against is that the context action on Android doesn't cover/replace the NavigationBar, but rather pushes it down and screws everything up.
Before Context
After Context
So what's up here? Has anyone figured out a way around this?
ADO.NET vs SQLLiteNet. Which one?
I am trying to determine what is the best approach for what data access type I should go with, ADO or SQLLiteNet.
The app will have about 20 tables, most tables 5-10 columns, with a few hundred records. A few tables could have in the several thousands of rows (with 10-15 columns).
Is one on the data access types better for performance or more recommended for certain type of database or apps?
Any articles or insight would be greatly appreciated.
Thank you, Ted
A Blank space in my Page showing when running xamarin form app in Windows 10 device
A Blank space in my Page showing when running xamarin form app in Windows 10 device, the same app is running fine in ios and android.
Please give a solution for this
Bottom Tabs for Xamarin.Android (in Xamarin.forms app)
I'm making app with using Xamarin.forms.
You all know regular tabs for Android from Xamarin.forms' TabbedPage is at top. Because it should be there if it's Native Android app that respect Android UX.
But things are changed now. Even Google announced new bottom tab bar called "bottom Navigation".
https://github.com/roughike/BottomBar
And many major apps are using bottom tab bar.
But I can't use new Bottom Navigation. Because my app is base on Xamarin.forms and uses TabbedPage from forms. It's going to be more complicated if I try to use bottom Navigation.
(I'm making iOS app from forms too)
So Best approach would be moving native Tabs to bottom.
So I found this. (maybe old)
http://envyandroid.com/align-tabhost-at-bottom/
But don't know how to use in Xamarin.Android. Could you help me?
Android exception on Release
When trying to build a release for android I have this exception when app starts:
FATAL EXCEPTION: main
Process: com.company.library, PID: 17600
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: android.runtime.JavaProxyThrowable: System.MissingMethodException: Method 'Xamarin.Forms.BindableObject.add_PropertyChanged' not found.
at LibCenterV1.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00037] in <314ff53f35d844ada778bea85fc3f69f>:0
at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <7a2a36256f1648ecbd0c15a75bc5a349>:0
at (wrapper dynamic-method) System.Object:56edd295-7081-43a1-9495-8c516fe739c7 (intptr,intptr,intptr)
at md5dba31f57b739a700094325f162a7e53c.MainActivity.n_onCreate(Native Method)
at md5dba31f57b739a700094325f162a7e53c.MainActivity.onCreate(MainActivity.java:31)
at android.app.Activity.performCreate(Activity.java:6272)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5525)
... 3 more
iOS application build Release mode issue
I am successfully lunch my application in Real iPhone device in debug mode but when i tried to build application in Release mode then give some old output means not taking effect that i did recently change in my code.
means I have issue that when i generate IPA file in debug mode than all is working fine but when i generate IPA file in Release Mode then iOS deployment consistently replaced by old output and new changes unable to take effect in application
I am also follow below link but not succeed
http://stackoverflow.com/questions/16973860/xamarin-ios-simulator-running-old-code
https://forums.xamarin.com/discussion/22617/cannot-clean-build
https://forums.xamarin.com/discussion/comment/266004#Comment_266004
Thanks,
how to make TableView right-to left?
the TableView control is by default layout it's childern from the left side of the screen.
is there a way to layout its childs control to begin from the right side?(the table section title,labels etc.)
Thanks
Forms9Patch: Simplify multi-device image management in your PCL Xamarin.Forms mobile apps
Announcement of Form9Patch
Xamarin Forms is great for developing apps on Android and iOS but it is missing two important tools for developers: scalable images and PCL multi-screen image management. Android developers use NinePatch bitmaps and the drawable directory naming convention for this purpose. Likewise, iOS developers use ResizeableImageWithCapInsets and the @2x, @3x, @4x file naming convention for this purpose.
Forms 9 Patch enhances Xamarin Forms to enable multi-resolution / multi-screen image management to PCL apps for iOS and Android.
What is it?
Simply stated, Forms9Patch is two separate elements (Image and ImageSource) which are multi-screen / multi-resolution extensions of their Xamarin Forms counterparts.
Forms9Patch.ImageSource
Xamarin Forms provides native iOS and Android multi-screen image management (described here). This requires storing your iOS images using the native iOS schema and storing your Android images using the Android schema. In other words, duplicative efforts to get the same results on both Android and iOS. Forms9Patch.ImageSource extends Xamarin.Forms.ImageSource capabilities to bring multi-screen image management to your PCL assemblies - so you only have to generate and configure your app's image resources once. Forms9Patch.ImageSource is a cross-platform implementation to sourcing multi-screen images in Xamarin Forms PCL apps as embedded resources.
Forms9Patch.Image
Forms9Patch.Image compliments Xamarin.Forms.Image to provide Xamarin Forms with a scaleable image element. Scalable images are images that fill their parent view by stretching in designated regions. The source image for the Forms9Patch.Image element can be specified either as a Forms9Patch.ImageSource or a Xamarin.Forms.ImageSource. Supported file formats are NinePatch (.9.png), .png, .jpg, .jpeg, .gif, .bmp, and .bmpf.
Example code
After adding the file bubble.9.png to your PCL project assembly as an EmbeddedResource, you can display it using something like the following:
var bubbleImage = new Forms9Patch.Image () {
Source = ImageSource.FromResource("MyDemoApp.Resources.bubble.9.png"),
HeightRequest = 110,
}
var label = new label () {
Text = "Forms9Path NinePatch Image",
HorizontalOptions = LayoutOptions.Center,
}
Example XAML
In Xamarin Forms, access to embedded resources from XAML requires some additional work. Unfortunately, Forms9Patch is no different. As with Xamarin Forms, you will need (in the same assembly as your embedded resource images) a simple custom XAML markup extension to load images using their ResourceID.
[ContentProperty ("Source")]
public class ImageMultiResourceExtension : IMarkupExtension
{
public string Source { get; set; }
public object ProvideValue (IServiceProvider serviceProvider)
{
if (Source == null)
return null;
// Do your translation lookup here, using whatever method you require
var imageSource = Forms9Patch.ImageSource.FromMultiResource(Source);
return imageSource;
}
}
Once you have the above, you can load your embedded resource images as shown in the below example. Be sure to add a namespace for the assembly that contains both your MarkupExtension and your EmbeddedResources (local in the below example).
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyXamlDemo;assembly=MyXamlDemo"
x:Class="MyXamlDemo.MyPage"
Padding="5, 20, 5, 5">
<ScrollView>
<ScrollView.Content>
<StackLayout>
<Label Text="Xamarin.Image"/>
<Image Source="{local:ImageMultiResource Forms9PatchDemo.Resources.image}"/>
</StackLayout>
</ScrollView.Content>
</ScrollView>
</ContentPage>
Where to learn more
Project page: http://Forms9Patch.com
Nuget page: https://www.nuget.org/packages/Forms9Patch/0.9.1
Demo app repository: https://github.com/baskren/Forms9PatchDemo
iOS mTouch Error
Hi,
I am developing an application at ESRI ArcGIS Runtime (Xamarin.Forms [Shared]). I am using a default ArcGIS template in Visual Studio. When i run the app for IOS, it runs successfully but whenever i zoom in 4-5 times, the application returns me the error below and i added xamarin log file. I think it is not about Esri ArcGIS Runtime, it is about Xamarin iOS Touch. How can i fix that?
This errors in Visual Studio 2015 Output:
2017-02-23 14:43:37.330 UniversalApp1[19079:218799]
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at System.Net.Http.NSUrlSessionHandler+NSUrlSessionHandlerDelegate.DidReceiveData (Foundation.NSUrlSession session, Foundation.NSUrlSessionDataTask dataTask, Foundation.NSData data) [0x00008] in /Users/builder/data/lanes/3985/35d1ccd0/source/xamarin-macios/src/Foundation/NSUrlSessionHandler.cs:267
2017-02-23 14:43:37.337 UniversalApp1[19079:218799] Unhandled managed exception:
Object reference not set to an instance of an object (System.NullReferenceException)
at System.Net.Http.NSUrlSessionHandler+NSUrlSessionHandlerDelegate.DidReceiveData (Foundation.NSUrlSession session, Foundation.NSUrlSessionDataTask dataTask, Foundation.NSData data) [0x00008] in /Users/builder/data/lanes/3985/35d1ccd0/source/xamarin-macios/src/Foundation/NSUrlSessionHandler.cs:267
2017-02-23 14:43:37.338 UniversalApp1[19079:218799] critical: Stacktrace:
2017-02-23 14:43:37.338 UniversalApp1[19079:218799] critical:
Native stacktrace:
2017-02-23 14:43:37.382 UniversalApp1[19079:218799] critical: 0 UniversalApp1 0x0000000107b34dfd mono_handle_native_sigsegv + 253
2017-02-23 14:43:37.382 UniversalApp1[19079:218799] critical: 1 libsystem_platform.dylib 0x0000000111427bba _sigtramp + 26
2017-02-23 14:43:37.382 UniversalApp1[19079:218799] critical: 2 libsystem_kernel.dylib 0x00000001113eb430 libsystem_kernel.dylib + 1072
2017-02-23 14:43:37.383 UniversalApp1[19079:218799] critical: 3 libsystem_c.dylib 0x000000011117efd7 abort + 129
2017-02-23 14:43:37.383 UniversalApp1[19079:218799] critical: 4 UniversalApp1 0x0000000107ccc61f xamarin_unhandled_exception_handler + 47
2017-02-23 14:43:37.383 UniversalApp1[19079:218799] critical: 5 UniversalApp1 0x0000000107b965fb mono_invoke_unhandled_exception_hook + 139
2017-02-23 14:43:37.383 UniversalApp1[19079:218799] critical: 6 UniversalApp1 0x0000000107b3464f mono_handle_exception_internal + 5135
2017-02-23 14:43:37.384 UniversalApp1[19079:218799] critical: 7 UniversalApp1 0x00000001
07b33238 mono_handle_exception + 24
2017-02-23 14:43:37.384 UniversalApp1[19079:218799] critical: 8 UniversalApp1 0x0000000107aa9e0b altstack_handle_and_restore + 59
2017-02-23 14:43:37.384 UniversalApp1[19079:218799] critical: 9 ??? 0x0000000121bac5b8 0x0 + 4860855736
2017-02-23 14:43:37.384 UniversalApp1[19079:218799] critical: 10 UniversalApp1 0x0000000107b45387 mono_jit_runtime_invoke + 2247
2017-02-23 14:43:37.385 UniversalApp1[19079:218799] critical: 11 UniversalApp1 0x0000000107bfa018 do_runtime_invoke + 88
2017-02-23 14:43:37.385 UniversalApp1[19079:218799] critical: 12 UniversalApp1 0x0000000107bf9f90 mono_runtime_invoke + 208
2017-02-23 14:43:37.385 UniversalApp1[19079:218799] critical: 13 UniversalApp1 0x0000000107cd15c5 xamarin_invoke_trampoline + 5589
2017-02-23 14:43:37.385 UniversalApp1[19079:218799] critical: 14 UniversalApp1
0x0000000107cd917d xamarin_arch_trampoline + 189
2017-02-23 14:43:37.386 UniversalApp1[19079:218799] critical: 15 UniversalApp1 0x0000000107cda531 xamarin_x86_64_common_trampoline + 110
2017-02-23 14:43:37.386 UniversalApp1[19079:218799] critical: 16 CFNetwork 0x000000010f9ec88c __67-[NSURLSession delegate_dataTask:didReceiveData:completionHandler:]_block_invoke.242 + 38
2017-02-23 14:43:37.386 UniversalApp1[19079:218799] critical: 17 Foundation 0x00000001098149ad __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
2017-02-23 14:43:37.386 UniversalApp1[19079:218799] critical: 18 Foundation 0x000000010981468f -[NSBlockOperation main] + 101
2017-02-23 14:43:37.387 UniversalApp1[19079:218799] critical: 19 Foundation 0x0000000109812d8c -[__NSOperationInternal _start:] + 672
2017-02-23 14:43:37.387 UniversalApp1[19079:218799] critical: 20 Foundation
0x000000010980eccf __NSOQSchedule_f + 201
2017-02-23 14:43:37.387 UniversalApp1[19079:218799] critical: 21 libdispatch.dylib 0x000000011108d12e _dispatch_client_callout + 8
2017-02-23 14:43:37.387 UniversalApp1[19079:218799] critical: 22 libdispatch.dylib 0x00000001110724cf _dispatch_queue_serial_drain + 1018
2017-02-23 14:43:37.388 UniversalApp1[19079:218799] critical: 23 libdispatch.dylib 0x0000000111072c9f _dispatch_queue_invoke + 1118
2017-02-23 14:43:37.388 UniversalApp1[19079:218799] critical: 24 libdispatch.dylib 0x00000001110749dc _dispatch_root_queue_drain + 506
2017-02-23 14:43:37.388 UniversalApp1[19079:218799] critical: 25 libdispatch.dylib 0x0000000111074782 _dispatch_worker_thread3 + 113
2017-02-23 14:43:37.388 UniversalApp1[19079:218799] critical: 26 libsystem_pthread.dylib 0x0000000111439712 _pthread_wqthread + 1299
2017-02-23 14:43:37.389 UniversalApp1[19079:218799] critical: 2
7 libsystem_pthread.dylib 0x00000001114391ed start_wqthread + 13
2017-02-23 14:43:37.389 UniversalApp1[19079:218799] critical:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
The app has been terminated.
Launch failed. The app 'UniversalApp1.iOS' could not be launched on 'iPhone SE iOS 10.2'. Error: An error occurred while executing MTouch. Please check the logs for more details.
The app has been terminated.
- Visual Studio 2015 ( Version: 14.0.25431.01 Update 3 )
- Xamarin 4.2.0 ( Xamarin.Android 7.0 – Xamarin.iOS 10.2 )
- ArcGIS Runtime 100 .Net SDK
Thanks in advance,
Sinan
Binding .JAR / using JNI
I'm trying to create a binding for Aspose.Words for Android. I'm following the guide at:
https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/
Unfortunately I'm getting all kinds of errors related to obfuscation.
e.g.
1>JARTOXML : warning J2XA006: missing class error was raised while reflecting com.aspose.words.zzDZ : asposewobfuscated/zzW8
I've got over 1,000 of these, so it's not just a matter of a few tweaks to the XML.
I'm thinking then that I need to consider this:
But I can't for the life of me find anything that tells me how to get the .JAR into my project, then invoke a method. All the examples seem to talk about the native methods that are already built-in.
Can anyone tell me what I'm missing here?
How to change app.name for Windows-phone..?
My app is named actually MatrixGuide.Winphone: (also so displayed in task-manager on phone).
I want to change it to (only) MatrixGuide.
How to do that..?:
If I change (only) the Assembliyname in the project settings from MatrixGuide.WinPhone to MatrixGuide, I can build the app, but then have a hard crash at runtime:
{System.NullReferenceException: Object reference not set to an instance of an object. at MatrixGuide.WinPhone.App..ctor()} System.Exception {System.NullReferenceException}
So.. I think, I have to change something more... but ... what...?
Thanks for any advise...
How to get Device Width/Height?
I'm trying to get the Device Width/Height, but everything I do comes back with -1
I'm trying
public class SomePage: ContentPage
{
private readonly StackLayout content;
public SomePage()
{
content = new StackLayout
{
HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.StartAndExpand
};
var width1 = Width; //-1
var width2 = content.Width; //-1
var width3 = Bounds.Width; //-1
var width4 = content.Bounds.Width; //-1
}
protected override void OnAppearing()
{
var width5 = Width; //-1
var width6 = Bounds.Width; //-1
var width7 = content.Width; //-1
var width8 = content.Bounds.Width; //-1
var width9 = Content.Width; //-1
var width10 = Content.Bounds.Width; //-1
}
}
Non of this seems to work.
Ideally there should be something in the Xamarin.Forms.Device
Namespace... Something like
public static readonly Xamarin.Forms.Rectangle Bounds {get { return // device specific bounds; }}
With the simple ability to call it.
var deviceWidth = Xamarin.Forms.Device.Bounds.Width;