Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

Xamarin App crashes on Reopen NullReference

$
0
0

I have an app on Xamarin, it works fine, if I press back button, to move to main menu it hides in app stack, so when I open it back from app stack it suddenly crashes with NullReference

06-10 15:59:57.363 I/MonoDroid(14891): UNHANDLED EXCEPTION:
    06-10 15:59:57.363 I/MonoDroid(14891): System.NullReferenceException: Object reference not set to an instance of an object
    06-10 15:59:57.363 I/MonoDroid(14891): at Xamarin.Forms.Platform.Android.FormsApplicationActivity.OnPrepareOptionsMenu (Android.Views.IMenu) <IL 0x00007, 0x00050>
    06-10 15:59:57.363 I/MonoDroid(14891): at Android.App.Activity.n_OnPrepareOptionsMenu_Landroid_view_Menu_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.App.Activity.cs:4151
    06-10 15:59:57.363 I/MonoDroid(14891): at (wrapper dynamic-method) object.87f976f0-8c0f-4463-92f4-c8ed92b6336d (intptr,intptr,intptr) <IL 0x00017, 0x0004b>
    06-10 15:59:57.383 D/AndroidRuntime(14891): Shutting down VM
    06-10 15:59:57.383 W/dalvikvm(14891): threadid=1: thread exiting with uncaught exception (group=0x41b66c08)
    An unhandled exception occured.

Any ideas will be helpful, stuck with it for too long


Linker Stripping Out Serialization

$
0
0

I've been using the following bit of code for years to save simple objects local storage.

using (FileStream fs = new FileStream(filename, FileMode.Create))
{
      DataContractSerializer dcs = new DataContractSerializer(typeof(T));
      dcs.WriteObject(fs, Object);
}

After the latest set of Xamarin updates this stopped working on Android when built in release mode. It still works on iOS and it works on Android if I turn off all linking. However, if I "link SDK Assemblies only" I get errors the following:

  • Missing Method Exception : Constructor on Type 'System.Runtime.Serialization.CollectionDataContract' Not Found.

Is there a way for me to force this to link correctly?

Use MasterDetail page (Menu) and Navigation page in a project

$
0
0

Hello All,

I am developing XF app for iOS and Andorid. I need to use Menu in my project. I followed this article to use MasterDetail navigation page - https://www.syntaxismyui.com/xamarin-forms-masterdetail-page-navigation-recipe/. And it is working fine.

But now I need to use navigation page before using MasterDetails page. Let me explain with an example -

*** LoginPage.cs is a simple content page that will be shown when app starts. After successful login app will show Menu (using MasterDetail navigation page).

  1. In my App.cs file I have used
    MainPage = new LoginPage ();

  2. In LoginPage after successfully login, I am using the code to load Menu (MasterDetails page)
    Application.Current.MainPage = new RootPage () // RootPage is a subclass of MasterDetail page

But problem is - after showing Menu, app is crashing without not showing any message in application log. I investigated and debug and found that app is crashing due to "Application.Current.MainPage = new RootPage ()". Though this code should be work.

So, my question is what is the best practice to use MasterDetail page after using normal navigation page ( MainPage = new LoginPage (); ).

Any suggestion will be highly appreciable!

Thank you,
Arefin

Displaying app's build information

$
0
0

Hi,

I need to show the build information ( build date and environment(Adhoc/Distribution) in my app which is for three platforms.I am able to get the version number .Pasted the code below.I will also need to display build date and environment.Please guide me how to achieve this.

#if __IOS__
                VersionNumber = NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString();
            #elif __ANDROID__
                Context context = Forms.Context;
                VersionNumber = context.PackageManager.GetPackageInfo(context.PackageName, 0).VersionName;
            #endif

iOS Inline Picker with Xamarin.Forms

$
0
0

Anybody have any guidance on how to go about having an iOS inline style picker in my Xamarin.Forms iOS app?

The Android side is fine as is I'm just being asked to make the iOS look more iOS.

Not having any luck in finding the right route to go about in terms of a custom renderer, and the only code examples I can find are incomplete and use MonoTouch Dialog.

Add TapGestureRecognizer to Custom Frame

$
0
0

Hi there.
I have a problem when working with TapGestureRecognizer. I have a custom of Frame. Inside custom Frame i add a StackLayout ( inside this StackLayout have few controls ). My code as bellow :

this.GestureRecognizers.Add (new TapGestureRecognizer {
                    Command = new Command (() => {
                    // ....
                    })});

On IOs it work perfect, but on android nothing happen when i tab on custom frame.
Any idea or keywork to help me resolve it?
Thank for your support

Getting my .resx file commented out after a semicolon

$
0
0

Hello, I've been following https://developer.xamarin.com/guides/cross-platform/xamarin-forms/localization/ in order implement localization and I have been stuck at a point where encoded values comment out the rest of my resx file. The sequence of encoded values are: : ; < > \" & \ % inside a values tag. It would look something like

<data name="userIdError" xml:space="preserve">
      <value>User ID can\'t contain spaces, or any of these special characters: (&#58; &#59; &lt; &gt; \&quot; &amp; \\ &#37; )</value>
    </data>

I have tried using their respective encoded values, : ; < > \" & \ %, and I would still get the file commented out after the semicolon. What should I do in this situation?

Thank you

Fatal signal 6 (SIGABRT)

$
0
0

Hi,
Since I upgraded to Xamarin 4.0 I have an issue. When I want to deploy my application on the test device (Android 4.4) I receive the following error (either Visual Studio 2013, 2015, or Xamarin Studio). Anyone is facing the same problem? Could you find any work around? It is almost one day that I stuck and cannot do anything!

Also, It is more than one week since I have upgraded to Xamarin 4.0 and still I could not connect to my mac build host (agent) to test my iOS application.

Microsoft Visual Studio Ultimate 2013

Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.6.00079
Installed Version: Ultimate
Visual C# 2013 06181-004-0449004-02440
Windows Phone SDK 8.0 - ENU 06181-004-0449004-02440
Windows Phone 8.1 SDK Integration 1.0
Xamarin 4.0.0.1689 (f860fe4)
Xamarin.Android 6.0.0.34 (3efa14c)
Xamarin.iOS 9.2.1.51 (3c0ec35)

Microsoft Visual Studio Enterprise 2015

Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079
Installed Version: Enterprise
Visual C# 2015 00322-80000-00000-AA068
Xamarin.iOS 9.2.1.51 (3c0ec35)

Xamarin Studio

Version 5.10 (build 871)
Installation UUID: 88f72eda-5030-43e9-8d1b-7658e8a17627
Runtime:
Microsoft .NET 4.0.30319.42000
GTK+ 2.24.23 (MS-Windows theme)
GTK# 2.12.30

=== Xamarin.Android ===

Version: 6.0.0 (Business Edition)
Android SDK: C:\Android\android-sdk
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1.0 rc1
SDK Build Tools Version: 23.0.2

Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_71
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

=== Build Information ===

Release ID: 510000871
Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
Build date: 2015-11-12 07:16:34-05
Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
Build lane: monodevelop-windows-cycle6

Windows 10.0.10240.0 (64-bit)


Auto rendering 20+ icons for iOS, Droid and WinPhone Apps

$
0
0

The number of icons needed to create a Xamarin Forms app is most irritating. That motivated me to hack together a WPF desktop application that renders application icons / splash screen using XAML (and places each file into my three-platform solution). It's not pretty, so I'm sure there has to be a better way. Is there a better way?

By the way, I also deleted the iOS LaunchScreen.storyboard from the .csproj file (and from the info.plist) so that way iOS just shows a splash screen image on startup.

MainWindow.xaml

<Window
    x:Class="IconGenerator.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Icon Generator" Height="2048" Width="2048">
    <Border x:Name="TheBorder" VerticalAlignment="Top" HorizontalAlignment="Left">
        <Border.Background>
            <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                <GradientStop Color="#FFA06000"/>
                <GradientStop Color="#FFFF8B00" Offset=".4"/>
            </LinearGradientBrush>
        </Border.Background>
        <Viewbox x:Name="TheIcon" Width="300" Height="300" VerticalAlignment="Bottom" HorizontalAlignment="Right">
            <Grid>
                <Path Data="M781.738,0.5 L782.188,0.896035 C828.028,42.1765 882.078,128.427 924.468,234.629 C938.598,270.03 950.258,304.715 959.358,337.505 L959.818,339.224 L960.598,341.338 C966.666,356.545 978.763,367.548 993.043,372.696 L999.238,374.459 L999.238,754.031 L0.5,754.031 L40.2531,726.078 L91.0831,692.867 L90.9501,692.385 L92.5061,691.09 C107.907,677.617 115.142,656.047 109.324,635.004 L108.669,632.849 L107.997,631.199 C95.4081,599.586 83.7211,564.909 73.5641,528.172 C42.7991,416.89 33.7981,314.621 45.8601,254.232 L46.4461,251.449 L54.5831,246.618 C70.9701,237.161 88.0621,228.111 105.782,219.561 C123.503,211.011 141.218,203.266 158.828,196.324 L161.928,195.144 L162.468,195.409 C217.478,223.335 292.108,292.547 360.678,384.056 C383.538,414.559 403.818,445.013 421.138,474.306 L422.028,475.846 L423.338,477.683 C436.428,495.154 457.918,502.62 477.998,498.675 L479.178,498.413 L504.438,489.024 C517.168,484.435 529.958,479.967 542.798,475.621 L583.788,462.314 L583.788,462.131 L585.628,461.286 C604.008,452.285 616.598,433.341 616.458,411.51 L616.388,409.258 L616.168,407.49 C612.248,373.69 609.988,337.167 609.738,299.052 C608.998,183.598 626.928,82.5111 654.288,27.3422 L655.578,24.8078 L664.688,22.2609 C682.978,17.3954 701.838,13.1057 721.168,9.46278 C740.508,5.81976 759.628,2.95322 778.428,0.831309 z" HorizontalAlignment="Left" Height="754" Margin="0.262,245.469,0,0" Stretch="Fill" UseLayoutRounding="False" VerticalAlignment="Top" Width="1000">
                    <Path.Fill>
                        <LinearGradientBrush EndPoint="1,1" MappingMode="RelativeToBoundingBox" StartPoint="0,0">
                            <GradientStop Color="Black" Offset="1"/>
                            <GradientStop Color="#FFCBCBCB"/>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
            </Grid>
        </Viewbox>
    </Border>
</Window>

MainWindow.xaml.cs

using System;
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;

namespace IconGenerator
{
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();

            Dispatcher.BeginInvoke((Action) (() =>
            {
                // From default Xamarin project
                Render("Droid\\Resources\\drawable", "icon.png", 72, 72);
                Render("Droid\\Resources\\drawable-hdpi", "icon.png", 72, 72);
                Render("Droid\\Resources\\drawable-xhdpi", "icon.png", 96, 96);
                Render("Droid\\Resources\\drawable-xxhdpi", "icon.png", 144, 144);

                // From edited Xamarin project (project properties, iOS Application)
                Render("iOS\\Resources", "Default.png", 320, 480);
                Render("iOS\\Resources", "Default@2x.png", 640, 960);
                Render("iOS\\Resources", "Default-568h@2x.png", 640, 1136);
                Render("iOS\\Resources", "Default-Landscape.png", 1024, 748);
                Render("iOS\\Resources", "Default-Landscape@2x.png", 2048, 1496);
                Render("iOS\\Resources", "Default-Portrait.png", 768, 1004);
                Render("iOS\\Resources", "Default-Portrait@2x.png", 1536, 2008);
                Render("iOS\\Resources", "Icon.png", 57, 57);
                Render("iOS\\Resources", "Icon@2x.png", 114, 114);
                Render("iOS\\Resources", "Icon-60.png", 60, 60);
                Render("iOS\\Resources", "Icon-60@2x.png", 120, 120);
                Render("iOS\\Resources", "Icon-60@3x.png", 180, 180);
                Render("iOS\\Resources", "Icon-72.png", 72, 72);
                Render("iOS\\Resources", "Icon-72@2x.png", 144, 144);
                Render("iOS\\Resources", "Icon-76.png", 76, 76);
                Render("iOS\\Resources", "Icon-76@2x.png", 152, 152);
                Render("iOS\\Resources", "Icon-Small.png", 29, 29);
                Render("iOS\\Resources", "Icon-Small@2x.png", 58, 58);
                Render("iOS\\Resources", "Icon-Small@3x.png", 87, 87);
                Render("iOS\\Resources", "Icon-Small-40.png", 40, 40);
                Render("iOS\\Resources", "Icon-Small-40@2x.png", 80, 80);
                Render("iOS\\Resources", "Icon-Small-40@3x.png", 120, 120);
                Render("iOS\\Resources", "Icon-Small-50.png", 50, 50);
                Render("iOS\\Resources", "Icon-Small-50@2x.png", 100, 100);

                // From default Xamarin project
                Render("WinPhone", "SplashScreenImage.jpg", 720, 1280);
                Render("WinPhone\\Assets", "AlignmentGrid.png", 768, 1280);
                Render("WinPhone\\Assets", "ApplicationIcon.png", 100, 100);
                Render("WinPhone\\Assets", "BadgeLogo.png", 58, 58);
                Render("WinPhone\\Assets", "Logo.png", 106, 106);
                Render("WinPhone\\Assets", "SplashScreen.png", 1152, 1920);
                Render("WinPhone\\Assets", "SquareTile71x71.png", 170, 170);
                Render("WinPhone\\Assets", "SquareTile150x150.png", 360, 360);
                Render("WinPhone\\Assets", "StoreLogo.png", 120, 120);
                Render("WinPhone\\Assets", "WideLogo.png", 744, 360);
                Render("WinPhone\\Assets\\Tiles", "FlipCycleTileLarge.png", 691, 336);
                Render("WinPhone\\Assets\\Tiles", "FlipCycleTileMedium.png", 336, 336);
                Render("WinPhone\\Assets\\Tiles", "FlipCycleTileSmall.png", 159, 159);
                Render("WinPhone\\Assets\\Tiles", "IconicTileMediumLarge.png", 130, 202);
                Render("WinPhone\\Assets\\Tiles", "IconicTileSmall.png", 70, 110);

                Application.Current.Shutdown();
            }), DispatcherPriority.ApplicationIdle);
        }

        private void Render(string folder, string name, int width, int height)
        {
            TheIcon.Width = width;
            TheIcon.Height = height;

            folder = "..\\..\\..\\Abc123\\Abc123." + folder;

            Dispatcher.Invoke(() => { }, DispatcherPriority.ApplicationIdle);

            var renderTargetBitmap = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Pbgra32);
            renderTargetBitmap.Render(TheBorder);
            var bitmapEncoder = (Path.GetExtension(name) == ".png") ? (BitmapEncoder)new PngBitmapEncoder() : new JpegBitmapEncoder();
            var bitmapFrame = BitmapFrame.Create(renderTargetBitmap);
            bitmapEncoder.Frames.Add(bitmapFrame);

            Directory.CreateDirectory(folder);
            using (var file = File.OpenWrite(Path.Combine(folder, name)))
            {
                bitmapEncoder.Save(file);
            }
        }
    }
}

Correct approach of adding zoom and panning capabilities to a custom Image renderer on iOS?

$
0
0

I'm creating an Image custom renderer for iOS on Xamarin.Forms. I'm able to successfully recognize the different touch gestures such as pinch gesture and swipe gestures in my iOS custom renderer. My problem is on how to add the zoom and panning functionality for that Image. Looking at the Xamarin documentation, they suggest a ScrollView to handle the zoom and panning functionality. Is there a way to add a ScrollView inside my Image renderer? Is this even the correct approach?

Thanks.

[UWP] CaptureElement only displays content after resize

$
0
0

I have a universal Windows app that uses a captureelement to display a camera stream (I set the CaptureElement in a custom renderer vor a View). The thing is, that the stream is only displayed after I manually reset the window (which also resizes the control).

In the renderer I use:

protected override void OnElementChanged(ElementChangedEventArgs<QRScannerControl> e)
{
    captureControl = new CaptureElement();
        this.SetNativeControl(captureControl);
}

to set the element and later in a separate method (on button pressed) I start the stream from a mediacapture element and set the source:

...
mediaCapture = cameraProvider.GetDeviceCameraStream() as MediaCapture;
await mediaCapture.InitializeAsync();
captureControl.Source = mediaCapture;
await mediaCapture.StartPreviewAsync();

What am I missing (I already updated to the latest Xamarin.Forms)?

How to attach an ImageSource object to an email?

$
0
0

I'm working on an Android dependency service to open the default email client and add an image attachment.
I'm passing an ImageSource object to the Android dependency service, but now I'm trying to add the ImageSource object being passed as an attachment in an email message. I've been researching this but all of the solutions I've found are reading from an actual file in the disk (see here)

This is what I have so far...

public void OpenEmailClient(ImageSource image)
{
    Intent email = new Intent(Android.Content.Intent.ActionSend);
    email.PutExtra(Android.Content.Intent.ExtraSubject, "Catalog page image");
    email.SetType("message/rfc822");
    // I'm trying to get the uri from the ImageSource object here...
    var uri = image.GetValue(UriImageSource.UriProperty);
    // The line below is giving an error - the uri variable is invalid
    email.PutExtra(Intent.ExtraStream, uri);

    Forms.Context.StartActivity(Intent.CreateChooser(email, "Send mail..."));       
}

Am I going to have to save the image in disk in order to be able to attach it to an email message?
Any ideas?

MVVM Binding Issues

$
0
0

Hello all,

I am having difficulty with the data bindings with xamarin and I was hoping someone might be able to see what I am doing wrong.

First created this in my resources

        <DataTemplate x:Key="tileTemplate">
            <Grid x:Name="gridTile" WidthRequest="90" HeightRequest="90" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="Aqua">
                <StackLayout>
                    <Grid BackgroundColor="{Binding Color}">
                        <!---<Image Source="{Binding Image}" IsVisible="{Binding IsVisible}" Height="70" Width="70" HorizontalOptions="Center"/>-->
                    </Grid>
                    <Grid HeightRequest="20" WidthRequest="90">
                        <StackLayout IsVisible="{Binding IsVisible}" BackgroundColor="Gray">
                            <TextCell Text="{Binding Text}" HeightRequest="20" TextColor="White" HorizontalOptions="CenterAndExpand"/>
                        </StackLayout>
                    </Grid>
                </StackLayout>
            </Grid>
        </DataTemplate>

In the constructor I have this.BindingContext = new TileBoardViewModel (); and in the same view as above I added

(using the gridview class from the xlab package)

        <controls:GridView
                x:Name="TileBoard" 
                HeightRequest="90"
                HorizontalOptions="CenterAndExpand"
                VerticalOptions="Center"                
                ItemsSource="{Binding TileTimes}" 
                ItemTemplate="{StaticResource tileTemplate}"/>

My observable collection of tiles gets populated but it doesn't show up in my view :(.

Is there something that I am missing or not getting?

Thanks for any help!!

Exception while trying to RaiseChild during Container.LayoutChanged on Android.

$
0
0

I am working on a video layout manager for a conference app. The following code is an excerpt for a Layout manager for a custom renderer. It works fine on iOS, but on Android it throws an System.InvalidOperationException: Cannot change ObservableCollection during a CollectionChanged event. when Container.RaiseChild (localVideoControl); is run after calling AddToContainer().

public class FormsLayoutManager : BaseLayoutManager
{
    public AbsoluteLayout Container { get; private set; }

    private bool InLayout = false;

    public FormsLayoutManager (AbsoluteLayout container, LayoutPreset preset)
        : base (preset)
    {
        Container = container;

        Container.LayoutChanged += (object sender, EventArgs e) => {
            if (!InLayout) {
                Device.BeginInvokeOnMainThread (DoLayout);
            }
        };
    }

    public override void AddToContainer (object control)
    {
        Container.Children.Add ((View)control);
    }

    public override void RemoveFromContainer (object control)
    {
        Container.Children.Remove ((View)control);
    }

    public override void ApplyLayout ()
    {
        InLayout = true;
        try {
            var localVideoControl = (View)GetLocalVideoControl ();
            var remoteVideoControls = GetRemoteVideoControls ();

            var layoutWidth = (int)Container.Width;
            var layoutHeight = (int)Container.Height;

            // Get the new layout.
            var layout = GetLayout (layoutWidth, layoutHeight, remoteVideoControls.Length);

            // Apply the local video frame.
            if (localVideoControl != null) {
                var localFrame = layout.LocalFrame;
                AbsoluteLayout.SetLayoutBounds (localVideoControl, new Rectangle (localFrame.X, localFrame.Y, localFrame.Width, localFrame.Height));

                if (Mode == LayoutMode.FloatLocal) {
                    Container.RaiseChild (localVideoControl);   //<--- System.InvalidOperationException: Cannot change ObservableCollection during a CollectionChanged event.
                }
            }

            // Apply the remote video frames.
            var remoteFrames = layout.RemoteFrames;
            for (int i = 0; i < remoteFrames.Length; i++) {
                var remoteFrame = remoteFrames [i];
                var remoteVideoControl = (View)remoteVideoControls [i];
                AbsoluteLayout.SetLayoutBounds (remoteVideoControl, new Rectangle (remoteFrame.X, remoteFrame.Y, remoteFrame.Width, remoteFrame.Height));

                if (Mode == LayoutMode.FloatRemote) {
                    Container.RaiseChild (remoteVideoControl);
                }
            }
            Container.ForceLayout ();
        } finally {
            InLayout = false;
        }
    }
}

How to use platform Idiom in Xaml

$
0
0

Although I can do the following in code, I want to do it in Xaml:

            if (Xamarin.Forms.Device.Idiom == TargetIdiom.Phone)
            {
                MainPage = new NavigationPage(new MyPage());
            }
            else if(Xamarin.Forms.Device.Idiom == TargetIdiom.Tablet)
            {
        // etc
            }
            else if(Xamarin.Forms.Device.Idiom == TargetIdiom.Desktop)
            {
        // etc
            }
            else if (Xamarin.Forms.Device.Idiom == TargetIdiom.Unsupported)
            {
                // etc
            }
            else
            {
                // etc
            }

Another post suggests the following, however it throws an error "OnIdiom" not found in xmlns: http://xamarin.com/schemas/2014/forms:

<StackLayout>
    <StackLayout.Orientation>
    <OnIdiom x:TypeArguments="StackOrientation">
        <OnIdiom.Phone>Vertical</OnIdiom.Phone>
        <OnIdiom.Tablet>Horizontal</OnIdiom.Tablet>
    </OnIdiom>
    </StackLayout.Orientation>
    <Label Text="child0"/>
    <Label Text="child1"/>          
</StackLayout>

Any ideas as to how to do this in Xaml?


Icon image on Toolbar item in xamarin Forms

$
0
0

Hi,
I'm creating all forms UI with the code using the Shared project. I want to add the icon image to the toolbar item. Can anyone guide me how can I achieve the same ? I could not find a suitable example in the docs section of Working with images. They mostly deal with the Local and Embedded Images. The sample code should work for all the platforms.

Thanks

[Custom Renderer/XF] Getting Native Camera Stream To Work

$
0
0

Please, before I explain and give code snippets, note that I do not want/need what Xamarin Forms Labs offers. That camera is intent, which is impractical to me, and I want to be able to customize the camera.

Anyway, I am attempting to get a native camera stream to work inside of Xamarin Forms. So far, I have a ContentPage called CameraPage:

http://pastie.org/9482010

And a custom renderer called CameraFrameRenderer:

http://pastie.org/9482011

The big question is, in the code above, how do I correctly pass in the CameraPreview (Code below, taken from example in monodroid) and allow viewing inside of Xamarin Forms.

Here is the code for the CameraPreview. Essentially, I want to be able to set the contents of ContentPage to that view. I have no idea how to do this part, and have researched/tried for hours now.

http://pastie.org/9482012

System.ArgumentException: 'jobject' must not be IntPtr.Zero

$
0
0

03-28 00:21:42.803 E/mono (30674): Unhandled Exception:
03-28 00:21:42.803 E/mono (30674): System.ArgumentException: 'jobject' must not be IntPtr.Zero.
03-28 00:21:42.803 E/mono (30674): Parameter name: jobject
03-28 00:21:42.803 E/mono (30674): at Android.Runtime.JNIEnv.CallVoidMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00010] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:500
03-28 00:21:42.803 E/mono (30674): at Android.Widget.AdapterView.set_OnItemClickListener (IOnItemClickListener value) [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.AdapterView.cs:944
03-28 00:21:42.803 E/mono (30674): at Xamarin.Forms.Platform.Android.ListViewAdapter.Dispose (Boolean disposing) [0x00000] in :0
03-28 00:21:42.803 E/mono (30674): at Java.Lang.Object.Finalize () [0x00056] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:61

Cannot resolve this issue, someone has any idea what could be the problem?

Line break in paragraph in Xamarin TextView

$
0
0

Hi All,

Am binding lines of content(Dynamically) into TextView, it looks like a paragraph for whole content, how split paragraph while binding content into TextView, I tried \n, HTML line break
but not working, please assist.

Example
Xamarin.Forms uses the word View to refer to visual objects such as buttons, labels or text entry boxes.
< Empty line >
These UI elements are typically are subclasses of View.

TextStyle:
Then we format the Content style like below
Bullet
• One
• Two
Numbering
1. One
2. Two
Bold, Italic, Underline.

Thanks,
Jai

Xamarin.Forms.Maps pins implementation

$
0
0

Hi guys,

The Maps implementations is really puzzling. I tested on Android a couple of months ago and now tested the iOS version - they both have the same pin implementation - every time the pin collection changes, all pins are removed and then all added back again. I mean come on! This is an ObservableCollection object - it says exactly what is changed. The performance with a 100 pins is just awful. On Android is even worse. Sure I can write a custom renderer, which then forces me to do custom click handling because Id member is internal and then god knows what will come up. I don't even have a clue how to wire a click event - that is why I am using (and paid for) Xamarin.Forms. Not that I can't learn it, but now I am forced to do so while on schedule.

Either I am missing something, or no one else is using pins, or they all have given up.

Don't get me wrong, this Xamarin thing is simply the best thing I've seen the past couple of years and that is some awesome work. I also imagine that you get many new customers and can't keep up, but this is junior work guys. I mean ObservableCollection was created exactly for that purpose so people don't do what you did in there.

Lets fix this, please.

Viewing all 91519 articles
Browse latest View live


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