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

Xamarin Forms App cannot connect with SSL web api

$
0
0

I have a xamarin forms app which connects fine if the web api is NON-SSL. I have written a windows console project to connect to the same web api(both ssl and non-ssl) and seems to work fine. I am using a self-signed certificate. Is this is a in Xamarin Forms?


Xamarin.Form Error: Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed.

$
0
0

I am getting couple of errors while trying to run xamarin forms app on android emulator:

A> Got this error randomly:
**Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/App2.Android-1: Package /data/app/App2.Android-1/base.apk code is missing] **

B>**The "LinkAssemblies" task failed unexpectedly.
**1>System.IO.IOException: The process cannot access the file 'obj\Debug\android\assets\App2.Android.dll' because it is being used by another process.
1> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1> at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
1> at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
1> at Xamarin.Android.Tools.Files.CopyIfChanged(String source, String destination)
1> at Xamarin.Android.Tasks.MonoAndroidHelper.CopyIfChanged(String source, String destination)
1> at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
1> at Xamarin.Android.Tasks.LinkAssemblies.Execute()
1> at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1> at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
1>Done building project "App2.Android.csproj" -- FAILED.

A have already tried by increase Java Max heap size to 1048 but still getting this error frequently.

Sometimes I am able to run xamarin forms app by cleaning and closing the solution and rebuild it.
Also I am not able to show data inside ListView. Here is my sample code:

MainPage.Xaml
<?xml version="1.0" encoding="utf-8" ?>

<ContentPage.Content>

<Grid.RowDefinitions>


</Grid.RowDefinitions>

MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace App2
{
public partial class MainPage : ContentPage
{
public List NameList { get; set; }
public MainPage()
{
NameList = new List();
NameList.Add(new Name { FirstName = "aaaa" });
NameList.Add(new Name { FirstName = "bbbb" });
NameList.Add(new Name { FirstName = "ccccc" });

        InitializeComponent();
    }
    protected override void OnAppearing()
    {
        BindingContext = NameList;
        base.OnAppearing();

    }
}
public class Name
{
    public string FirstName { get; set; }
}

}

It is a PCL project.
I am using latest xamarin version, jdk 1.8, Android 7.1 platform.
Android emulator running on API level 25, using host GPU and 2048 RAM.
**
Please help me to fix this issues**

Formatted Label with Xamarin.Forms

$
0
0

Can someone please show me how to use Xamarin.Forms.Label.FormattedText correctly?

I'm using Xamarin.Forms to write a Carousel based app, when I try

Label IntroductionTextLabel = new Label(); IntroductionTextLabel.FormattedText = "Test";

I get this error:

"'Xamarin.Forms.Label' does not contain a definition for 'FormattedText' and no extension method 'FormattedText' accepting a first argument of type 'Xamarin.Forms.Label' could be found (are you missing a using directive or an assembly reference?)"

Perhaps it's the version of Xamarin I'm currently using...

The next step would be using this to display some HTML.

Thanks for any help.

skiasharp is not work in local:view

$
0
0

There is One Page and One View.

In page's xaml file

<ContentPage.Content>
        <ScrollView Orientation="Vertical">
            <StackLayout HorizontalOptions="FillAndExpand">
                <local:InnerView/>
            </StackLayout>
        </ScrollView>
</ContentPage.Content>

I made skiasharp in InnerView, but skiasharp is not work in that view.

how can i apply skiasharp in local view?

Getting control after INavigation.PopAsync() in Xamarin Forms

$
0
0

I have PageA + ViewModelA, and PageB + ViewModelB.

From A i'm calling PushAsync(B), editing some data, and calling PopAsync().

So now B becomes closed, and user returns to A.

But in B user changed some state, that should be update on A. What is the correct way to notify A to update state (and it would be better to have access to ViewModelB).

Open browser and start searching a keyword saved in local db

$
0
0

I am using following code for opening google from my xamarin forms app.

 Device.OpenUri(new Uri("http://www.google.com"));

I am also saving a string in my local DB using the following code.

 Application.Current.Properties["MyIP"] = mystring;

I want to open the browser and search this keyword automatically. Is it possible?

Thanks in advance.

Does anyone know how to resolve this error.

$
0
0

The project runs good at start, but after running two to three times , i am getting this error. Can anyone please help me.

Errror:
Severity Code Description Project File Line Suppression State
Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'ICSharpCode.SharpZipLib.Portable, Version=0.86.0.51803, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'ICSharpCode.SharpZipLib.Portable.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) in /Users/builder/data/lanes/5809/22d97e15/source/monodroid/external/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 229
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) abc.Android

Merge between Font Attribute and Font Family in same Label #383

$
0
0

how to use FontAttribute and FontFamily in same Label ?
and how to use converter in FontFamily ?

please any solution


MasterDetailPage IsPresented is completely ignored.

$
0
0

Two issues:

(1) If I set IsPresented = true on the OnAppearing() method of my MasterDetailPage, the Master menu is shown and then is immediately closed automatically. A video showing the Master closing on load: https://dl.dropboxusercontent.com/u/11453596/Videos/masterClosing.mov

    protected override void OnAppearing()
    {
        base.OnAppearing();
        IsPresented = true;
    }

(2) If I set IsPresented = true anywhere else, nothing happens at all.

I'm using Xamarin.Forms 1.3.0.6292. Any idea?


public class HomePage : MasterDetailPage
{
    public HomePage()
    {
        Detail = new Detail();
        Master = new ContentPage() {
            Title = "Master...",
            Content = new Label {
                    Text = "Master..."
            }
        };

        IsGestureEnabled = false;
    }

    protected override void OnAppearing()
    {
        base.OnAppearing();
        IsPresented = true;
    }
}

public class Detail : ContentPage
{
    public Detail()
    {
        var bt = new Button() {
            Text = "Drawer"
        };
        bt.Clicked += (sender, e) => App.Master.IsPresented = true;

        Content = bt;
    }
}

Highlight listview text

$
0
0

I have a listview and search bar in my apps, I able to filterr the list based on the search bar input but I dont know how to hightlight the listview text that contain the search bar input. Can anyone help?

Listview is not populating after navigation

$
0
0

I have listview defined in xaml as below:
<ListView x:Name="Iv" ItemSelected="Iv_ItemSelected" ItemsSource="{Binding deviceListEx}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Label Text="{Binding .}" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

This does work in first page load, however in ios platform when I navigate to another page then back to the listview page by clicking back button, the page is blank, means listview is not populated.
Application is in c# and working fine in android.

Have anyone faced such issue or similar issue? Do let me know how can I solve this.

Merge between Font Attribute and Font Family in same Label #383

$
0
0

how to use FontAttribute and FontFamily in same Label ?
and how to use converter in FontFamily ?

please any solution

MasterDetailPage IsPresented is completely ignored.

$
0
0

Two issues:

(1) If I set IsPresented = true on the OnAppearing() method of my MasterDetailPage, the Master menu is shown and then is immediately closed automatically. A video showing the Master closing on load: https://dl.dropboxusercontent.com/u/11453596/Videos/masterClosing.mov

    protected override void OnAppearing()
    {
        base.OnAppearing();
        IsPresented = true;
    }

(2) If I set IsPresented = true anywhere else, nothing happens at all.

I'm using Xamarin.Forms 1.3.0.6292. Any idea?


public class HomePage : MasterDetailPage
{
    public HomePage()
    {
        Detail = new Detail();
        Master = new ContentPage() {
            Title = "Master...",
            Content = new Label {
                    Text = "Master..."
            }
        };

        IsGestureEnabled = false;
    }

    protected override void OnAppearing()
    {
        base.OnAppearing();
        IsPresented = true;
    }
}

public class Detail : ContentPage
{
    public Detail()
    {
        var bt = new Button() {
            Text = "Drawer"
        };
        bt.Clicked += (sender, e) => App.Master.IsPresented = true;

        Content = bt;
    }
}

Any solution for OAuth FB/Google without webviews

$
0
0

Hello all,

I'm developping an app in which I'd like the user to log with fb or google account. So far I've been using Xamarin Auth which provides a OAuth authentification with webviews.

As I want to realease the app on markets, I checked the future deprecation of this component. Google made an annoucement saying that they will block any OAuth in webviews from April 20th 2017 ...

Have you find a solution to Xamarin Auth for google sign in ?

I've seen a component for FireBase published by xamarin 25 days ago ... but I wonder if it will work for forms as it is a xamarin android component ... And I'd like to keep the logic that "forms is crossplatform" and I do not want to use a plugin for each project.

And I do not want to keep xamarin auth only for Facebook, as I'm sure that they will apply the same policy as google in the future for webviews auth (for all reasons they gave)

I've been seeking the web but no solutions...

I'm glad if someone's found something or a workaround without components if there are none ..

Cheers.

Once IsGestureEnabled is set to false, setting it to true again doesn't have any effect on iOS

$
0
0

I need to toggle the value of my MasterDetailPage property of "IsGestureEnabled" when opening and closing its Master page. To accomplish this, I have an event handler to change the value of this property...

 this.IsPresentedChanged += ((object sender, EventArgs args) =>
            {
                System.Diagnostics.Debug.WriteLine("==> IsPresentedChanged event, this.IsPresented = {0}", this.IsPresented);
                this.IsGestureEnabled = this.IsPresented;
            });

This event handler works as expected, however, once I change the IsGestureEnabled property to false, setting it to true again doesn't have any effect on iOS. I think this is a Xamarin bug since I'm not the only one experiecing this issue (see here).

Is there a workaround for this?

Thanks.


CultureInfo.CurrentCulture always returns 'en-US' in iOS 11

$
0
0

I've noticed that in iOS 11 the value of System.Globalization.CultureInfo.CurrentCulture always seems to return 'en-US' regardless of the language actually set on device. I never saw this issue with iOS 10 (that is it always returned the language of the device) so I'm not sure if this is a bug or some other change under iOS 11.

SearchBar Cancel Button not visible when Text is empty

$
0
0

Using Forms version 2.0.
When the SearchBar receives focus and the Text is empty, the Cancel button is not visible. Only when Text is non-empty the Cancel button is displayed.
Therefor you can not dismiss the keyboard when Text is empty. I think the Cancel button should always be visible when the SearchBar has focus.
I have a workaround that puts a space in the Text property when it's emptied but thats far from ideal.

How to implement native android xaml file in Xamarin.Forms?

$
0
0

I can't use xaml file, which contains native android code in my Xamarin.Forum project as variable.

Hybridwebview iOS url not loading

$
0
0

I have implemented the hybridwebview as per the document. Android and UWP works fine. iOS when url are is provide nothing is show in hybridwebview.
I have SET NSAppTransportSecurity also.

Please help

Attempting to JIT compile method

$
0
0

iOS app, using a .NET standard library. And using EntityFramework for SQLite.
The iOS app calls a routine to add an entity into a table:

msg = new QTNC.NETStandard.Models.Message();
msg.Received = DateTime.Now.ToUniversalTime();
msg.Created = DateTime.Parse(messageReceived["Created"]);
msg.Body = messageReceived["body"];
msg.HtmlBody = messageReceived["HtmlBody"];
msg.Title = messageReceived["title"];
msg.ProductName = messageReceived["ProductName"];
msg.TextColor = messageReceived["TextColor"];
msg.BackgroundColor = messageReceived["BackgroundColor"];
msg.Id = Guid.Parse(messageReceived["Id"]);
msg.Read = DateTime.Now;
database.Messages.Add(msg);
database.SaveChangesAsync();
return msg;

And message is defined as:

public class Message
{
[Key]
public Guid Id { get; set; }
public string ProductName { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public DateTime Received { get; set; }
public DateTime Read { get; set; }
public DateTime Created { get; set; }
public string HtmlBody { get; set; }
public string TextColor { get; set; }
public string BackgroundColor { get; set; }
}

The error happens on the database.Messages.Add(msg);

Attempting to JIT compile method '(wrapper runtime-invoke) :runtime_invoke_void__this___Guid_object_object_DateTime_object_object_DateTime_DateTime_object_object (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.

the Read property btw was nullable at first, and interestingly the error was almost the same but was referring to a DateTime then as well.

And BTW, the link mentioned in the error (https://developer.xamarin.com/guides/ios/advanced_topics/limitations/) does not exist....

And a question on the side:
msg.Received = DateTime.Now.ToUniversalTime();
msg.Created = DateTime.Parse(messageReceived["Created"]);

messageReceived["Created"] is a string that contains a UTC time ,
but if I look at the value of msg.Created it shows me that value in localtime, why? (msg.Received shows the UTC time)

Viewing all 58056 articles
Browse latest View live


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