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

How make a circle label?

$
0
0

Hi, i have a list of label and i have to add into a label a text and then a counter. The counter must be a circle with a number in it.

This is the code of the counter:
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="6*" /> <ColumnDefinition Width="4*" /> </Grid.ColumnDefinitions> <cr:ExtendedLabel x:Name="InnerLabel" Grid.Column="0" FontSize="25" FontWeight="Normal" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="End" TextColor="White" VerticalOptions="CenterAndExpand" VerticalTextAlignment="Center" /> <Label x:Name="Etichetta" Text="1" Grid.Column="1" HorizontalTextAlignment="Start"/> </Grid>
This code just to that...

Does anyone knows how to do that circle for the counter?

Thanks a lot


CreateFragment OutOfMemory

$
0
0

Hi,

I found out Native2Forms feature recently and I think it's a really nice feature.
The app was written Xamarin.Forms before and now I am trying to translate into Xamarin Android.
Using Native2Forms, I can translate the code page by page and want to keep some pages in Xamarin forms.

However, I've experienced OOM crash on my app if I open a new activity that has a fragment generated by CreateFragment().

Really basic things like below inside Activity.

var cp = new ContentPage().CreateFragment(this);

FragmentManager
.BeginTransaction()
.Replace(Resource.Id.fragment_container, cp)
.Commit();

If I open this Activity and close like 10 times, app crashes because of OOM.

Has anyone else experienced something like this?

error MSB6006: "apksigner.BAT" since upgrading to VS 15.6

$
0
0

Has anyone had any problem with the signing their apks while deploying since upgrading to VS 15.6? If I run the command that VS is using on the command line I get the message.

Missing input APK

BUT note the apk file is definitely in the directory that the command is using.

Is VS 15.6 the first version to use apksigner rather than jarsigner? Anyone have any ideas about how to fix this?

Two views issue. Android custom renderer is placed over Xamarin.Forms element

$
0
0

Hello. I have a problem and I do not know how to solve it. I have a custom view LibraryGridView built in Xamarin.Forms which I am using in UWP and iOS. The code works fine and the layout is correct. The view looks like this:

public class LibraryGridView : FlowLayout
{
    public LibraryGridView()
    {
        // code
    }
}

FlowLayout looks like this:

    public class FlowLayout : Layout<View>
    {
        // code

        protected override void LayoutChildren(double x, double y, double width, double height)
        {
            // code
        }

        protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
        {
            // code
        }

        // code
    }

Android renderer looks like this:

public class LibraryGridViewRenderer : ViewRenderer<LibraryGridView, global::Android.Views.View>
{
    // code
}

Now my issue is when I try to create a custom renderer in Android for LibraryGridView. The view works and is lays out correctly. However, I am getting double controls. I get the LibraryGridView control from Xamarin.Forms layed on top of my LibraryGridViewRenderer. How do I make sure for Android I am only showing the LibraryGridViewRenderer and not the Xamarin.Forms LibraryGridView?

I tried to hide the elements in the FlowLayout when running Android, but then the Height and Width of the LibraryGridViewRenderer is lost. Is there a way to fix showing two views, or a way to hide the elements in the Forms view, while keeping the Height and Width of the Renderer? It's a tough question! I spent about 10 hours on this and I have a headache. I included a still frame of the issue.

Thanks for help!

How can i access contacts from contact list in my app through Xamarin UI Test?

$
0
0

I am trying to add a contact from contact list , but i am not able to do that.
so is it possible to access other apps in Simulator or local devices?

Android Support Animated Vector Drawable Error.

Expandable panel: custom control?

$
0
0

Hi, this is my first post. Before I ask my question I just wanted to thank the forum users as although I haven't posted before many of my development issues over the last few months have been solved by scouring through previous posts.

I'm fairly new to Xamarin development, so apologies if this is a simple question.

There is an app that I use, weatherzone (android), that has what looks like a scrollable list, with expandable panels (I have attached a file). I would be grateful if someone would be able to advise on how to replicate this panel and scrollable list. Is it a custom control?

Weatherzone is a really cool app by the way, the pic doesn't do it justice.

Draw not called on UIView with Invisible parent.

$
0
0

I have a grid that holds multiple Buttons.
I have a customrenderer for the Buttons (ButtonRenderer). Inside this customrenderer, I have overriden the Draw(Rect rect) method.
However Draw does not get called, if the parent grid has IsVisible set to false when the buttons get initialized.
Also when the grid changes the IsVisible property, the Draw method is still not being called, therefore the buttons remain undrawn.

How can I make the buttons get drawn?
Do I have to manually climb up the view hierachy on initialization and look for a parent and then check for the IsVisible property? This would be kind of a mess


Pb with the last updates of Xamarin iOs

$
0
0

Hello,
Since I update the VS2017 on 6 of March 2018, for iOs my App crash on startup and I don't know why.

Could you help ?
Thx
cjacquel

Attempted to divide by zero.

$
0
0

Dear everyone,

I got that error when I using Xamarin.Forms.CarouselView.

Could you help me.

Thanks.

Archive Distribute Button not Working

$
0
0

After I made the update for Xamarin 4.9.0.749 yesterday, the button Distribute in the Archive Manager simply don't answer. It is like it is not enabled.
My project builds fine, without errors, also no error is displayed during archive process and there are no build comments.
I`m using VS 2015 Community Version 14.0.25431.01 update 3.

The only different thing I noticed, is that when I open a project, it shows a message that Components are not supported anymore, to migrate to nugets. I already deleted the components everywhere (project, folder and appData/xamarin/cache/Components) and the message still shows.

Anyone knows how to proceed?

Support email for XU?

$
0
0

I've been sending emails to training@xamarin.com without any success, no replies at all, is it still valid?

Creating a singleton with Dependency service, but no interface?

$
0
0

I have been doing a lot of James Montemagno Tutorials and his CoffeeApp one is confusing me a little
https://github.com/jamesmontemagno/app-coffeecups/blob/master/CoffeeCups.Shared/ViewModel/CoffeesViewModel.cs

He wants to create a singleton of the AzureService that connects to a SQL table database. Which makes sense, and something I want to do in my app. I want it to define the server connection once, so that I can query from it on any page I am at. But he creates the singleton by using Dependency Services.

AzureService azureService;
public CoffeesViewModel()
{
azureService = DependencyService.Get();
}
From my understanding Dependency Service is used to access platform specific features. Which in turn creates singleton by default. But in this example he is not calling anything in the Android or iOS project. AzureService is in the shared project. Plus This Link says that you should be puting an interface into the <> not a normal class.

I have seen other ways of creating Singletons, with using statics and seal classes like this link

But I have done both and they do not seem to work. Or, more likely I don't understand Singletons. I imagine them like I create it once and it lives in memory. And if I call any method from an Interface of the Singleton object I don't need to do
var _singleton = new Singleton();

Just so that I can do
ISingleton.PushAsync();

But that seems to be the case, because if I call any of the ISingleton methods in any page outside where I made the singleton it gives me this error
System.NullReferenceException: Object reference not set to an instance of an object.

Do I have to make a new instance of the singleton on every page I go to?

TimePicker PropertyChanged Event Not Fired if the time doesn't change

$
0
0

I have used a 24 hours TimePicker in my Xamarin Forms project. The TimePicker works perfectly in my iOS project but on Android the UnFocused event is not called, also the PropertyChange event is not fired when I click on Ok or Cancel without changing the time.

The timepicker opens up with the time value binded in the xaml and I want the same time to be set on click of Ok without changing the time.

Say I have binded 7 hrs from xaml, TimePicker opens with 7:00 selected but if I click Ok and Cancel without changing the time it sets 0: 00.

Following is my 24 hrs TimePicker implementation in Android:

p ublic class TimePicker24Hours : ViewRenderer<TimePicker, Android.Widget.EditText>, TimePickerDialog.IOnTimeSetListener, IJavaObject, IDisposable
{
private TimePickerDialog dialog = null;

    protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
    {
        base.OnElementChanged(e);
        this.SetNativeControl(new Android.Widget.EditText(Forms.Context));
        this.Control.Click += Control_Click;
        this.Control.Text = DateTime.Now.ToString("HH:mm");
        this.Control.KeyListener = null;
        this.Control.FocusChange += Control_FocusChange;
    }

    void Control_FocusChange(object sender, Android.Views.View.FocusChangeEventArgs e)
    {
        if (e.HasFocus)
            ShowTimePicker();
    }

    void Control_Click(object sender, EventArgs e)
    {
        ShowTimePicker();
    }

    private void ShowTimePicker()
    {
        if (dialog == null)
        {
            dialog = new TimePickerDialog(Forms.Context, this, 0, 0, true);
        }

        dialog.Show();

    }

    public void OnTimeSet(Android.Widget.TimePicker view, int hourOfDay, int minute)
    {
        var time = new TimeSpan(hourOfDay, minute, 0);
        this.Element.SetValue(TimePicker.TimeProperty, time);

        this.Control.Text = time.ToString(@"hh\:mm");
    }

The OnTimeSet method is called when I click on Ok or Cancel but sets 0 hrs 0 min if I don't change the time.

The FocusChangeevent in the android implementation is not getting fired when TimePicker is unfocused.

How to launch Application on click of a custom files from outside

$
0
0

Hello Everyone ,
I wanted to register a custom file type to my application and as a result when user click on that file from outside (say from email attachment) then it should automatically launch and show the document content.
I knew in native iOS & Android we can do it by registering the custom file types and through some of the app life cycle methods( for eg : In iOS Application:OpenUrl)
I'm looking for a similar solution in Xamarin.Form because I have already developed the application using Forms and my application is to support 3 platforms ( UWP , iOS & Android )

Thanks In Advance,
Vishnu


Cannot access a disposed object. Object name: 'Android.Widget.ListView'.

$
0
0

Has anybody encountered a crash like this? Is there any workaround?

StackTrace:
[MonoDroid] System.ObjectDisposedException: Cannot access a disposed object.
[MonoDroid] Object name: 'Android.Widget.ListView'.
[MonoDroid] at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <6cd960837cc24c26bab2a0a29b597627>:0
[MonoDroid] at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <6cd960837cc24c26bab2a0a29b597627>:0
[MonoDroid] at Android.Widget.ListView.RemoveHeaderView (Android.Views.View v) [0x00031] in :0
[MonoDroid] at Xamarin.Forms.Platform.Android.ListViewAdapter.OnDataChanged () [0x0002c] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\SliderRenderer.cs:21
[MonoDroid] at Xamarin.Forms.Platform.Android.ListViewAdapter.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\SliderRenderer.cs:20
[MonoDroid] at Xamarin.Forms.Internals.TemplatedItemsList2[TView,TItem].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplatedItemsList.cs:758 [MonoDroid] at Xamarin.Forms.Internals.TemplatedItemsList2[TView,TItem].OnProxyCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e, System.Boolean fixWindows) [0x0047a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplatedItemsList.cs:1101
[MonoDroid] at Xamarin.Forms.Internals.TemplatedItemsList2[TView,TItem].OnProxyCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplatedItemsList.cs:955 [MonoDroid] at Xamarin.Forms.Internals.TemplatedItemsList2[TView,TItem].OnItemsSourceChanged (System.Boolean fromGrouping) [0x00061] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplatedItemsList.cs:936
[MonoDroid] at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].BindableOnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00020] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplatedItemsList.cs:648
[MonoDroid] at (wrapper delegate-invoke) :invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
[MonoDroid] at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:137
[MonoDroid] at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:388
[MonoDroid] at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:592
[MonoDroid] at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:389
[MonoDroid] at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:174
[MonoDroid] at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:56
[MonoDroid] at Xamarin.Forms.BindingExpression+BindingExpressionPart.b__47_0 () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:540
[MonoDroid] at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in :0
[MonoDroid] at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in :0
[MonoDroid] at (wrapper dynamic-method) System.Object:d901f7dc-e1dd-4118-a519-234449748f0c (intptr,intptr)
[Mono] GC_BRIDGE waiting for bridge processing to finish
[art] Starting a blocking GC Explicit
[art] Explicit concurrent mark sweep GC freed 4861(418KB) AllocSpace objects, 13(260KB) LOS objects, 8% free, 22MB/24MB, paused 421us total 7.220ms
[Mono] GC_TAR_BRIDGE bridges 14 objects 14 opaque 0 colors 14 colors-bridged 14 colors-visible 14 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.03ms tarjan 0.02ms scc-setup 0.03ms gather-xref 0.01ms xref-setup 0.01ms cleanup 0.42ms
[Mono] GC_BRIDGE: Complete, was running for 8.83ms
[Mono] GC_MINOR: (Nursery full) time 5.93ms, stw 9.15ms promoted 2022K major size: 18896K in use: 17158K los size: 19456K in use: 15869K
[Mono] GC_BRIDGE waiting for bridge processing to finish
[art] Starting a blocking GC Explicit
[art] Explicit concurrent mark sweep GC freed 7972(615KB) AllocSpace objects, 18(456KB) LOS objects, 8% free, 21MB/23MB, paused 440us total 7.116ms
[Mono] GC_TAR_BRIDGE bridges 584 objects 45678 opaque 14980 colors 293 colors-bridged 260 colors-visible 260 xref 53 cache-hit 0 cache-semihit 0 cache-miss 33 setup 0.05ms tarjan 9.97ms scc-setup 0.06ms gather-xref 0.06ms xref-setup 0.02ms cleanup 6.02ms
[Mono] GC_BRIDGE: Complete, was running for 18.32ms
[Mono] GC_MAJOR_SWEEP: major size: 18720K in use: 16595K
[Mono] GC_MAJOR: (LOS overflow) time 32.03ms, stw 35.39ms los size: 9216K in use: 634K
Steps to reproduce:
1. Opening app
2. Press physical back button (close the app)
3. Above 2 steps many times (and once app is crashing)

Designer shows black screen in visual studio

$
0
0

Hi All,
Since a few days, the designer in Xamarin started to show a black screen. at first this was sometimes, but today it was all the time.
I tried updating visual studio, windows and all nuget packages but this only helped a bit. it's now showing correctly 1 out of 20 times or so, others are a black screen.
This is happening with all my axml files when I try to open them

I noticed the following error showing up in my event viewer:

Fault bucket 1428500924365490863, type 5
Event Name: VisualStudioNonFatalErrors2
Response: Not available
Cab Id: 0

Problem signature:
P1: devenv.exe
P2: 15.6.27428.1
P3: vs.xamarin-designer.faults
P4: System.NullReferenceException
P5: Xamarin.AndroidDesigner
P6: Xamarin.AndroidDesigner.DesignerProject.get_AllGeneratedResources
P7: _
P8: _
P9: _
P10: _

My operating system is Windows 8.1 and my visual studio version is 15.6.0

How can I fix this?

ERROR WITH LATEST NUGET v2.5.0.77 "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded

$
0
0

I just got latest stable 2.5.0.77107 and I can't compile anymore

[myUser]\packages\xamarin.forms\2.5.0.77107\build\netstandard1.0\Xamarin.Forms.targets(55,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly [myUser]\.nuget\packages\xamarin.forms\2.5.0.77107\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

I replaced my user path with [myUser]

it looks like this bug exists since October in the pre-release:

https://bugzilla.xamarin.com/show_bug.cgi?id=60293

Facing issue with Binding Library and get an exception Foundation.ModelNotImplementedException

$
0
0

Actually, I have made the Binding Library or DLL file for magtek device but when I amgoing to use it's methods So, I am getting an exception like Foundation.ModelNotimplementedException and 'Foundation.You_Should_Not_Call_base_In_This_Method', below are the code in which I am facing this issue:
mtSCRALib = new MTSCRA();
window = new UIWindow((System.Drawing.RectangleF)UIScreen.MainScreen.Bounds);

    **mtSCRALib.ListenForEvents(MTSCRATransactionEvent.OK | MTSCRATransactionEvent.Start | MTSCRATransactionEvent.Error);**

    if (gMagTekReader == MTSCRADeviceType.MagTekIDynamo)
    {
        mtSCRALib.SetDeviceType(MTSCRADeviceType.MagTekIDynamo);
        mtSCRALib.SetDeviceProtocolString(gMagTekProtocolString);
    }
    else
    {
        mtSCRALib.SetDeviceType(MTSCRADeviceType.MagTekAudioReader);
    }

    mtSCRALib.OpenDevice();
    DevConnStatusChange();

Is there anything wrong in my DLL file or code.

Android.OS is not visible even if there's the reference in the project

$
0
0

The problem is the questin inserted in the question.

Viewing all 204402 articles
Browse latest View live


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