Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Lottie transparent background?

$
0
0

I suppose that many people already using lottie. i am just evaluating it.
1) Does xamarin forms version support all android and ios versions? is there any known issue
2) most of the files have background color, does it support transparency? how do you make json file transparent? i read somewhere that lottie app helps for it. but on the app i cant find any background as transparent and i dont even see a save option after doing your changes on a file.


Not able to get byte array from Signature pad image , throwing exception

$
0
0

Not able to get byte array from Signature pad image , throwing exception

public static byte[] ReadFully(Stream input)
{
using (MemoryStream ms = new MemoryStream())
{
input.CopyTo(ms);
return ms.ToArray();
}

    }

Not able to get byte array from Signature pad image , throwing exception

$
0
0

.
public static void ImageSerialzationAsync(Stream img)
{

                var signatureMemoryStream = new MemoryStream();
                img.CopyTo(signatureMemoryStream);
                byte[] data = signatureMemoryStream.ToArray();


    }

Exception message is Cannot access a closed Stream. as per below . Please let me know any suggestions stuck with this for few hours
System.ObjectDisposedException: Cannot access a closed Stream.
at System.IO.Stream.CopyTo (System.IO.Stream destination)

This class is not key value coding-compliant for the key

$
0
0

Hi,

I'm a beginner at C# and very new to iOS and Xamarin - but am teaching myself and making some progress towards my first app (a battle calculator for an iOS game). I have two issues which I have been unable to resolve on my own after hours of fiddling and scouring the web.

For my root controller I have a TabBarController which has 2 NavigationControllers and one standard ViewController set as its tabs. The page that is being loaded has several buttons of which I have one wired via an outlet to push a new ViewController onto the NavigationController in the first tab. Loading this up in the simulator has no problems. Deploying to my device throws me this exception:

Objective-C exception thrown. Name: NSUnknownKeyException Reason: [<screenAttacker 0x16593570> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key btnWall.

I've seen that this could be caused by setting a Main Interface in the info.plist and can confirm that both the iPad and iPhone sections are blank for this field.

Also this can be caused by outlets not being deleted correctly or objects being linked to outlets which no longer exist etc. I deleted all entries in the .h and .m files and removed all outlet connections (in deleted and re-added all buttons also) and created a fresh one.

The second (and I'm assuming unrelated) issue is warnings MT3005 & MT3006 - also only when deploying to device:

Warning MT3005: The dependency 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' of the assembly 'monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' was not found. Please review the project's references. (MT3005)

Warning MT3006: Could not compute a complete dependency map for the project. This will result in slower build times because Xamarin.iOS can't properly detect what needs to be rebuilt (and what does not need to be rebuilt). Please review previous warnings for more details. (MT3006)

Any help with these two issues would be greatly appreciated. Its driving me nuts. Below I've included that AppDelegate, ViewController and .h / .m files associated. Please let me know if you need any more info.

Cheers!

AppDelegate.cs:

`using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace KEBC
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{

    public static UIWindow window;
    public static UITabBarController rootTab;
    public static UINavigationController navAttacker;
    public static UINavigationController navDefender;
    public override bool FinishedLaunching (UIApplication app, NSDictionary options)
    {

        window = new UIWindow (UIScreen.MainScreen.Bounds);

        screenAttacker screenAttacker = new screenAttacker ();
        screenDefender screenDefender = new screenDefender ();
        screenSummary screenSummary = new screenSummary ();
        navAttacker = new UINavigationController (screenAttacker);
        navDefender = new UINavigationController (screenDefender);
        navAttacker.Title = "Attacker";
        navDefender.Title = "Defender";
        screenSummary.Title = "Summary";


        rootTab = new UITabBarController ();
        UIViewController[] tabs = new UIViewController[] {
            navAttacker,
            navDefender,
            screenSummary
        };
        rootTab.ViewControllers = tabs;

        window.RootViewController = rootTab;

        // make the window visible
        window.MakeKeyAndVisible ();

        return true;
    }
}

}`

screenAttacker.cs:

`using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace KEBC
{
public partial class screenAttacker : UIViewController
{
static bool UserInterfaceIdiomIsPhone {
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
}

    public screenAttacker ()
        : base (UserInterfaceIdiomIsPhone ? "screenAttacker_iPhone" : "screenAttacker_iPad", null)
    {
    }

    public override void DidReceiveMemoryWarning ()
    {

        base.DidReceiveMemoryWarning ();

    }

    public override void ViewWillAppear(bool animated)
    {
        base.ViewWillAppear (animated);
        this.NavigationController.SetNavigationBarHidden (true, animated);
    }

    public override void ViewWillDisappear(bool animated)
    {
        base.ViewWillAppear (animated);
        this.NavigationController.SetNavigationBarHidden (false, animated);
    }

    public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();
        this.Title = "Attacker";
        btnWall.TouchUpInside += (sender, e) => {
            AppDelegate.navAttacker.PushViewController(new screenWall(), true);
        };

    }

}

}`

screenAttack.h:

`#import <Foundation/Foundation.h>

import <UIKit/UIKit.h>

@interface screenAttacker : UIViewController {
}

@property (retain, nonatomic) IBOutlet UIButton *btnWall;

@end`

screenAttacker.m:

`#import "screenAttacker.h"

@implementation screenAttacker

  • (void)dealloc {
    [_btnWall release];
    [super dealloc];
    }
    @end`

How to use Fontawesome PRO in Xamarin Forms

Search Bar and button placed improperly in landscape view despite constraints

$
0
0

Hello everyone,

I'm trying to add constraints to my button and search bar elements and they work fine in Portrait mode on multiple platforms including ipad, but as soon as I change to landscape view everything brakes and constraints showing conflicts on Iphone's only. Interesting is the fact that Landscape mode on Ipads is completely fine, and works as I imagine it to. I'm new and learning so might have overlooked something, does anyone have any ideas why this weird behavior?

Project has no fancy structure, just pulled up a default single page template on visual studio and dropped a button and SearchBar.

Attaching a gif of how I go about the storyboard. Thanks for your help!

Basic Local Storage - How to?

$
0
0

Hi,

I have seen sqlite but I am asking what if I want a simple local storage just to save one variable user_id to determine the user ID?

What's the best way yo do it so even if the user closes the app or the phone it will still be stored?

Kindly advise...

Thanks,
Jassim

How to make and entry to go on a new line everytime it exceeds specific width

$
0
0

I've looked everywhere for this but found only stuff about labels . So i want to make a description entry so I can get the text and add it to a database later.
So the description can be something like max 250 words and should go on a new line everytime the user exceeds the width (what i mean by that is the same way it creates a new line everytime you seem to go outside the rectangle).


Waiting for button click

$
0
0

public void Application()
{
Method1(); // Lets say this will change color of something.
Method2(); // this method has the button defined and it generates random number and saves it to int HH for example <- I need to wait here until it generates the number and then continue with Method3
Method3(); // This has a switch (HH) and changes lets say text label (this method needs the generated number HH from button click in Method2())
}

ANY SUGGESTION HOW TO WAIT FOR GENERATED NUMBER AND AFTER GENERATING CONTINUE WITH METHOD3()?

Pass parameters in Command Xamarin

$
0
0

I have this view :

<StackLayout> <ListView ItemsSource="{Binding DatasModels}" x:Name="listViewDatas" ItemSelected="Handle_ItemSelected"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Orientation="Horizontal"> <Label Text="{Binding firstname}"/> <Label Text="{Binding lastname}"/> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> <StackLayout Orientation="Horizontal"> <Button BackgroundColor="Maroon" Text="Add" Command="{Binding AddDataJson}" CommandParameter="{Binding Source={x:Reference entry}, Path=Text}"/> </StackLayout> </StackLayout>

This viewModel :

`
public ICommand AddDataJson { get; private set; }

public listViewMenuModels()
    {
        AddDataJson = new Command<string>(addDataJson);
    }

    private void addDataJson(string stringUpdate)
    {
        RestApiManager.AddData(stringUpdate);

    }`

So in the view, the x:reference doesn't work. It don't find the reference.
I have try without a listview and it's works. But the listview be problematic.

Thanks

Xamarin.Forms uploading to OneDrive and DropBox

$
0
0

Hi all,

I'm new to Xamarin.Forms. I've created my first app. It has an SQLite database local. I want an option to back this file up to OneDrive and/or DropBox.

Is there a recent example on how to do this? I have searched and found some older ones but I cannot get them to function correctly.

Much appreciate your time.

Thank you

Is it ok/ good practice to use preferences in xamarin as switches?

$
0
0

Is it a bad practice to use a preference like this:

Preferences.Set ("USE_CUSTOM_SOUND_KEY", true);

and then somewhere in the app:

var useCustomSound = Preferences.Get("USE_CUSTOM_SOUND_KEY", false);

if (useCustomSound)
{
     // use custom sound for action
}

And if its ok, is there a limit to how many of these preferences can be set and used as global app switches within the app?
Any downsides?

What's the best/simplest library for creating and displaying a QR code based on a string?

$
0
0

I've got a Xamarin app that have iOS and Android versions (.NET Standard business layer).

I've been asked to add a QR code to one of the screens. It'll encode a short string. I can't talk out to an API for this, so needs to be done on the device.

I'm looking for a simple, supported library that'll generate a QR code for me and allow me to display it on the device. Ideally will be iOS and Android, but I could use different ones for both.

I don't need scanning features.

I came across the ZXing.Net.Mobile, but looked like it could be heavier than I need, so wondered if anyone had experience/knowledge of a lighter weight solution.

[Xamarin Forms] Help on the dynamism of button and picker controls

$
0
0

Good evening, everyone,

First of all know that I am a beginner with xamarin and development on mobile platforms, I use the visual studio development environment with the C# language.

This is my problem:

I have created several buttons, I would like that depending on the buttons I click there are different elements in a picker.

For example: if I click on the North Pole button there are in the picker all the communes that concern the North Pole and if I click on the South Pole there are all the communes that concern this pole.

Do I make myself understood? If so, is that possible?

here is my code on the xaml side:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="PolQual.Views.StatementReferencielPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:PolQual.Views"
    xmlns:viewModels="clr-namespace:PolQual.ViewModels;assembly=PolQual"
    Title="Accueil">

    <ContentPage.BindingContext>
        <viewModels:StatementReferencielPageModel />
    </ContentPage.BindingContext>

    <ContentPage.Content>

        <StackLayout>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="8*" />
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="40" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100*" />
                </Grid.ColumnDefinitions>

                <Label
                    Grid.Row="0"
                    Grid.Column="0"
                    FontSize="25"
                    HorizontalOptions="Center"
                    Text="Information sur le relevé référenciel" />

                <Label
                    x:Name="ErrorLabel"
                    Grid.Row="2"
                    Grid.Column="0"
                    FontSize="20"
                    HeightRequest="55"
                    HorizontalTextAlignment="Center"
                    TextColor="white"
                    VerticalTextAlignment="Center" />

            </Grid>

            <ScrollView>
                <Grid x:Name="gridLayout" />
            </ScrollView>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="8*" />
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="25*" />
                    <ColumnDefinition Width="50*" />
                    <ColumnDefinition Width="25*" />
                </Grid.ColumnDefinitions>

                <Label
                    Grid.Row="1"
                    Grid.Column="1"
                    FontSize="15"
                    Text="Veuillez sélectioner le secteur :" />

                <Picker
                    x:Name="PickerSectorsLists"
                    Title="Sélectionner votre secteur"
                    Grid.Row="2"
                    Grid.Column="1"
                    ItemDisplayBinding="{Binding Value}"
                    ItemsSource="{Binding SectorsLists}"
                    SelectedItem="{Binding SelectedSector}" />

                <Label
                    Grid.Row="4"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowHouseholdTrash}" />

                <Switch
                    x:Name="SwitchHousehodTrash"
                    Grid.Row="5"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding HouseholdTrash}" />

                <Label
                    Grid.Row="6"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowBoxboard}" />

                <Switch
                    x:Name="SwitchBoxboard"
                    Grid.Row="7"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding Boxboard}" />

                <Label
                    Grid.Row="8"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowGlass}" />

                <Switch
                    x:Name="SwitchGlass"
                    Grid.Row="9"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding Glass}" />

                <Button
                    Grid.Row="11"
                    Grid.Column="1"
                    BackgroundColor="#2196f3"
                    Clicked="GoToAssesmentGrid"
                    FontSize="20"
                    Text="Valider les informations"
                    TextColor="White" />

            </Grid>

        </StackLayout>

    </ContentPage.Content>
</ContentPage>

Behind C# side

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using PolQual.ViewModels;

namespace PolQual.Views
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class StatementReferencielPage : ContentPage
    {
        private List<Pole> PolesLists { get; set; }

        public StatementReferencielPage()
        {
            InitializeComponent ();
            //BindingContext = new StatementReferencielPageModel();

            PolesLists = new List<Pole>
            {
                new Pole { Key = 1, Name = "Erdre et Cens", Color = "ffccd5"},
                new Pole { Key = 1, Name = "Erdre et Loire", Color = "ff4d4d"},
                new Pole { Key = 1, Name = "Loire-Sèvre et vignoble", Color = "ff9933"},
                new Pole { Key = 1, Name = "Sud-Ouest", Color = "bfbfbf"},
                new Pole { Key = 1, Name = "Loire-chézine", Color = "ffff4d"},
                new Pole { Key = 1, Name = "Nantes-Ouest", Color = "3385ff"},
                new Pole { Key = 1, Name = "Nantes-Loire", Color = "53c653"},
            };

            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            //collmun
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(25, GridUnitType.Star) });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50, GridUnitType.Star) });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(25, GridUnitType.Star) });

            var PolesListsIndex = 0;

            for (int columnIndex = 1; columnIndex < 2; columnIndex++)
            {
                for (int rowIndex = 0; rowIndex < 7; rowIndex++)
                {
                    if (PolesListsIndex >= PolesLists.Count)
                    {
                        return;
                    }
                    var poles = PolesLists[PolesListsIndex];
                    PolesListsIndex += 1;

                    var button = new Button
                    {
                        Text = poles.Name,
                        BackgroundColor = Color.FromHex(poles.Color),
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions = LayoutOptions.Center,
                        WidthRequest = 280,
                    };
                    button.Clicked += async (object sender, EventArgs e) => await Navigation.PushAsync(new AssesmentGridPage());
                    gridLayout.Children.Add(button, columnIndex, rowIndex);
                }
            }
        }

        public void GoToAssesmentGrid(object sender, System.EventArgs e)
        {
            if (PickerSectorsLists.SelectedIndex == -1) 
            {
                ErrorLabel.BackgroundColor = Color.FromHex("ef5350");
                ErrorLabel.Text = "Veuillez sélectioner un secteur !";
                return;
            }
            else
            {
                var page = new AssesmentGridPage();
                Navigation.PushAsync(page);
                ErrorLabel.Text = null;
                ErrorLabel.BackgroundColor = Color.FromHex("#FFFFFF");
            }
         }

        public class Pole
        {
            public int Key { get; set; }
            public string Color { get; set; }
            public string Name { get; set; }
        }
    }
}

Project must be deployed before it can be started

$
0
0

I'm using Visual Studio 2013 and I'm trying to run the Xamarin store app for the Android project side and I receive the message:

The project XamarinStore.Droid needs to be deployed before it can be started.
Verify the project is select to be deployed in the Solution Configuration Manager.

I'm using the Xamarin Android Player for an emulator. Is this the recommended practice? All examples I see always shows "Mixed Platforms" when debugging.


Error CS0656 Missing compiler required member "microsoft.csharp.runtimerbinder.binder.convert"

$
0
0

Error CS0656 Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.Convert' App1 C:\Users\user\OneDrive\desktop\folder\App1\App1\App1\Services\ApiServices.cs line 66 Active

The error is apparently due to this line of code -->JObject jwtDynamic = JsonConvert.DeserializeObject(content);
I have tried adding a refrence to Microsoft.CSharp in the android project (which is the project i use on my emulator). And I have tried to install the Microsoft.CSharp nuget package. Nothing seems to work, so any tips are appreciated.

Check Internet connectivity

$
0
0

Hi,
Can anybody suggest me how to check internet connectivity for both iOS and Android commonly using xamarin forms?

Thanks,
sunil

Compile Error trying to bind a ABBYY RTR SDK.AAR file via Xamarin Android Binding project

$
0
0

I get the error below when I try to bind the "abbyy-rtr-sdk-1.0.aar" downloaded from https://rtrsdk.com/#RTR.Android.Online using Xamarin Android Binding project in Visual Studio 2017, by following the link https://docs.microsoft.com/en-gb/xamarin/android/platform/binding-java-library/binding-an-aar

Severity    Code    Description    Project    File    Line    Suppression State
Error    CS0234    The type or namespace name 'IRecognitionContextHolder' does not exist in the namespace 'Com.Abbyy.Mobile.Ocr4' (are you missing an assembly reference?)    AbbyLib    C:\_MyLab\Xamarin\My\OCR\TextRecogniser\AbbyLib\obj\Debug\generated\src\Com.Abbyy.Mobile.Ocr4.IRecognitionManager.cs    481    Active

Severity    Code    Description    Project    File    Line    Suppression State
Error    CS0738    'IDataCaptureServiceInvoker' does not implement interface member 'IRecognitionService.ExtendedSettings'. 'IDataCaptureServiceInvoker.ExtendedSettings' cannot implement 'IRecognitionService.ExtendedSettings' because it does not have the matching return type of 'IRecognitionServiceExtendedSettings'.    AbbyLib    C:\_MyLab\Xamarin\My\OCR\TextRecogniser\AbbyLib\obj\Debug\generated\src\Com.Abbyy.Mobile.Rtr.IDataCaptureService.cs    679    Active

Error    CS0738    'ITextCaptureServiceInvoker' does not implement interface member 'IRecognitionService.ExtendedSettings'. 'ITextCaptureServiceInvoker.ExtendedSettings' cannot implement 'IRecognitionService.ExtendedSettings' because it does not have the matching return type of 'IRecognitionServiceExtendedSettings'.    AbbyLib    C:\_MyLab\Xamarin\My\OCR\TextRecogniser\AbbyLib\obj\Debug\generated\src\Com.Abbyy.Mobile.Rtr.ITextCaptureService.cs    681    Active

trying to add binding library

$
0
0

I am trying to add binding library "JiaoZiVideoPlayer" to my xamarin.android project but I am getting the following error
_invokedynamic requires --min-sdk-version >= 26 _what this means and how I can solve this issue

bellow the screen shot of my project minsdk

image

Could not AOT the assembly.. Xamarin Forms Android

$
0
0

Hi Guys,
I've been struggling with compiling my project with AOT Compile for the last 3 days. It's really important as reducing startup times is a massive requirement in this project. Whenever I go to build and deploy I get the following error multiple times: Could not AOT the assembly

The number of assemblies that I get the error message on seems to change every build + deploy this may also be caused by change to configuration.

Visual Studio Enterprise: v15.9.5
Xamarin Android v9.1.5.0
Build Mode: Release, Any CPU
Xamarin.Forms v3.40

Android Config:

Build Logs attached.

James

Viewing all 204402 articles
Browse latest View live


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