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

Media Element crash when navigating away from page on Ios

$
0
0

I am getting Media Element disposing exception when I navigate back to a previous page from a page where I have my Media Element.

The managed Managed Stacktrace:

          at <unknown> <0xffffffff>
          at ObjCRuntime.Messaging:void_objc_msgSend_IntPtr <0x00007>
          at AVFoundation.AVPlayer:ReplaceCurrentItemWithPlayerItem <0x0005b>
          at Xamarin.Forms.Platform.iOS.MediaElementRenderer:Dispose <0x002b7>
          at Foundation.NSObject:Dispose <0x00023>

My steps to reproduce were:
Push new page with MediaElement. Click play on video.
Click back to pop page.
Page does pop but UI becomes unresponsive.

my code is:

public partial class SermonsMediaPlayer : ContentPage
            {
                private Sermon Sermon;

                public SermonsMediaPlayer(Sermon selectedSermon)
                {
                    InitializeComponent();

                    if (selectedSermon is null)
                    {
                        Sermon = new Sermon();
                    }

                    Sermon = selectedSermon;
                    BindingContext = Sermon;

                }

                async void Back_Clicked(object sender, EventArgs args)
                {
                    // release media resources
                    if (mediaPlayer.CurrentState == MediaElementState.Playing)
                    {

                        mediaPlayer.Stop();
                        await Navigation.PopModalAsync();
                    }

                    await Navigation.PopModalAsync();
                }

                protected override void OnDisappearing()
                {
                    base.OnDisappearing();
                }
            }


        <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="xxxViews.SermonsMediaPlayer">
            <ContentPage.ToolbarItems>
                <ToolbarItem Text="Back" Clicked="Back_Clicked" />
            </ContentPage.ToolbarItems>
            <ContentPage.Content>
                <Grid>
                    <MediaElement x:Name="mediaPlayer" Source="{Binding Url}" AutoPlay="False"
                      ShowsPlaybackControls="True" KeepScreenOn="False" />
                </Grid>
            </ContentPage.Content>
        </ContentPage>

Xamarin bindable properties Lottie animation

$
0
0

I am trying to achieve an animated check box, I have created boolean property.

It is working but when focus on page from other page, animation plays from begin to end.

My purpose is to play an animation till frames are set if value is true.

Thanks in advance.

Model

public  class WishListItem
{
    public string Art_code { get; set; }
    public string ImageUrl { get; set; }

    private bool _SendRequest;
    public bool SendRequest { get => _SendRequest; set { _SendRequest = value; RaisePropertyChanged(); } }

    public event PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged([CallerMemberName] string propertyName = "")
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}

VM

public class WishList: INotifyPropertyChanged
{
    private ObservableCollection<WishListItem> _WishCount;

    public ObservableCollection<WishListItem> WishCount {
        get => _WishCount;
        set
        {
            _WishCount = value;
            RaisePropertyChanged();
        }
    }

    public WishList()
    {
        WishCount = new ObservableCollection<WishListItem>();
        WishCount = GetItems().Result;
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged([CallerMemberName] string propertyName = "")
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }

    public async Task<ObservableCollection<WishListItem>> GetItems()
    {
        foreach (var i in WishListService.WishListNew)
        {
            WishCount.Add(i); //Adding data 
        }

        return WishCount;
    }
}

Control

public class CustomCheckBox : AnimationView, IDisposable
{
    public string AnimationFile { get; set; }

    public CustomCheckBox()
    {
        Animation = "check.json";
        OnClick += Checkbox_OnClick;
    }

    public static BindableProperty IsCheckedProperty = BindableProperty.Create(
        nameof(IsChecked), typeof(bool), typeof(CustomCheckBox), defaultBindingMode: BindingMode.TwoWay,
        propertyChanged: IsCheckedChanged);

    public bool IsChecked
    {
        get { return (bool)GetValue(IsCheckedProperty); }
        set { SetValue(IsCheckedProperty, value); }
    }

    private static void IsCheckedChanged(BindableObject bindable, object oldValue, object newValue)
    {
        //   var cb = (CustomCheckBox)bindable;
        if (!(bindable is CustomCheckBox cb))
            return;

        if ((bool)newValue)
        {
            // cb.Play();
            cb.PlayFrameSegment(1, 50);
        }
        else
        {
            cb.PlayFrameSegment(1, 5);
            cb.IsPlaying = false;
        //    cb.Reset();
        }
    }

    void Reset()
    {
        Animation = null;
        Animation = AnimationFile;
    }

    void Checkbox_OnClick(object sender, EventArgs e)
    {
        IsChecked = !IsChecked;
    }

    public void Dispose()
    {
      OnClick -= Checkbox_OnClick;
    }
}

Xaml

<controls:CustomCheckBox x:Name="CustCheck" Grid.Row="0"  Grid.Column="1" VerticalOptions="End"                          
          IsChecked="{Binding SendRequest, Mode=TwoWay}" HeightRequest="35" WidthRequest="35" />

How to download catmouse 2.5 apk for free?

$
0
0

Hi everybody.
I am a regular user catmouse apps to watch movies and favorite channels free with high quality. I recently found the appearance of the version catmouse 2.5 apk used by many people. So I really want to experience version catmouse 2.5 apk. I have searched all sources but could not find where to download catmouse 2.5 apk for free, who knows can share with me?
Thanks everyone!

How to deserialize JSON

$
0
0

I am developing an application with xamarin forms.I have a json data I pulled from the url, I do this operation via method.

var url = await _ContractService.GetContractList();

var json = url.Content.Items;

I want to deserialize this data I have taken. because i'm printing some data i get from json on listview

I want to redirect other information about the same data to another page with listview item selected.

Please help me I couldn't at least an idea

public class ContractList
 {
     public List<Item> Items { get; set; }
     public long PageIndex { get; set; }
     public long PageCount { get; set; }
     public long RecordCount { get; set; }
 }

 public class Contract
 {
     public long Id { get; set; }
     public string CompanyCode { get; set; }
     public string OCompanyCode { get; set; }
     public long? OutletNumber { get; set; }
     public string OutletName { get; set; }
     public long? MasterOutletNumber { get; set; }
     public string MasterOutletName { get; set; }
     public string CustomerCode { get; set; }
     public long ContractUniqueNumber { get; set; }
     public object MyaContractNumber { get; set; }
     public long? OutletTradeGroupCode { get; set; }
     public string OutletTradeGroupText { get; set; }
     public long? KeyAccountCode { get; set; }
     public string KeyAccountText { get; set; }
     public long ContractNumber { get; set; }
     public string Definition { get; set; }
     public long EpNumber { get; set; }
     public long VersionNumber { get; set; }
     public DateTimeOffset StartDate { get; set; }
     public DateTimeOffset? EpStartDate { get; set; }
     public object MyaepStartDate { get; set; }
     public DateTimeOffset EndDate { get; set; }
     public DateTimeOffset? ValidEndDate { get; set; }
     public DateTimeOffset CreateDate { get; set; }
     public long ContractState { get; set; }
     public long WorkFlowApprovalStatusCode { get; set; }
     public string CustomerName { get; set; }
     public CustomerType CustomerType { get; set; }
     public OutletBusinessTypeExtensionCode? OutletBusinessTypeExtensionCode { get; set; }
     public OutletSegmentCode? OutletSegmentCode { get; set; }
     public long? OutletSalesCenterCode { get; set; }
     public long ContractScopeCode { get; set; }
     public string ContractScopeName { get; set; }
     public long Quota { get; set; }
     public QuotaName QuotaName { get; set; }
     public long? QuotaAmount { get; set; }
     public long? OutletSubTradeChannelCode { get; set; }
     public long PromotionTypeCode { get; set; }
     public object PromotionTypeName { get; set; }
     public WorkFlowApprovalStatusName WorkFlowApprovalStatusName { get; set; }
     public long ContractType { get; set; }
     public bool IsTemplate { get; set; }
     public long? PaymentTypeCode { get; set; }
     public PaymentTypeName? PaymentTypeName { get; set; }
     public DistBusinessTypeExtensionCode? DistBusinessTypeExtensionCode { get; set; }
     public DistBusinessTypeExtensionCode? ODistBusinessTypeExtensionCode { get; set; }
     public long? DistNumber { get; set; }
     public OutletChannelCode? OutletChannelCode { get; set; }
     public object SwitchOutletNumber { get; set; }
     public long CaseTypeCode { get; set; }
     public object SwitchDate { get; set; }
     public long CreateUser { get; set; }
     public object CreateUserTitle { get; set; }
     public long? OldContractUniqueNumber { get; set; }
     public bool HasEp { get; set; }
     public bool HasRevized { get; set; }
     public bool IsFixedPriced { get; set; }
     public bool IsCustomerContract { get; set; }
     public object DistChangeText { get; set; }
     public long AttachmentCount { get; set; }
     public double? CompletionRatio { get; set; }
     public CountryCode CountryCode { get; set; }
     public bool Promotion { get; set; }
     public bool? FreeTimeBased { get; set; }
     public string OutletLocationCode { get; set; }
     public DistBusinessTypeExtensionCode? PlDistType { get; set; }
     public long? Defertment { get; set; }
     public bool HasWarranty { get; set; }
     public bool ManualVoyageEnt { get; set; }
     public KeyAccountManagerCode? KeyAccountManagerCode { get; set; }
     public string NationalKeyAccountManagerCode { get; set; }
     public object ContractTerminateTypeCode { get; set; }
     public object ContractTerminateTypeName { get; set; }
     public SpectraCoaType? SpectraCoaType { get; set; }
     public bool HasContractFree { get; set; }
     public bool HasSatisTahminEkKatilim { get; set; }
     public TypeEnum Type { get; set; }
     public object HashKey { get; set; }
     public long? AsmCode { get; set; }
     public string AsmTitle { get; set; }
     public bool IsBid { get; set; }
     public bool IadesizlikPrimi { get; set; }
     public bool HasPfkb { get; set; }
     public bool HasPesinBed { get; set; }
     public bool HasZamanBed { get; set; }
     public long Time { get; set; }
     public long Time1 { get; set; }
     public bool StampDuty { get; set; }
     public long ItemCustomerType { get; set; }
     public bool HasUda { get; set; }
     public bool HasBailText { get; set; }
     public bool IsCiroPrimFaturaMerkez { get; set; }
     public bool FailContract { get; set; }
     public long? NewMasterOutletNumber { get; set; }
     public string NewMasterOutletName { get; set; }
     public long IsChangeMasterOutlet { get; set; }
     public bool NoContractFor3Month { get; set; }
 }
var url = await _ContractService.GetContractList();

var json = url.Content.Items;

ContractList list= JsonConvert.DeserializeObject<ContractList>(json);

Debug.WriteLine(list.ContractNumber);
Debug.WriteLine(list.StartDate.ToString());

Scrollview is not working when applied for listview with itemselected function

$
0
0

Hello Sir,
Scrollview is not working when applied for listview with itemselected function.Please help Thanks

How to raise click event on nested listview ?

$
0
0

Hello all,

Can anyone please help me to understand how to call nested item click event in prism?

Getting error like The requested resource does not support http method 'POST'. in Web Api

$
0
0

Hello Sir, Im trying to update the status of 2 tables using web api but getting below error The requested resource does not support http method 'POST'. Please help me Thanks in advance.
Below is the web api code

public Response UpdateUserDeTails(useraccounts userdetails)
{
Response response = new Response();
try
{
SqlCommand cmd = new SqlCommand("update table1 t1 join table2 t2 on t1.userId = t2.userId set t1.status = " + 0 + ", t2.status = " + 0 + " where t1.userId = @userId", con);
cmd.Parameters.AddWithValue("@userId", userdetails.userId);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
if (i >= 1)
{
response.Message = "User details deleted successfully";
response.Status = 1;
}
else
{
response.Message = "Failed to save";
response.Status = 0;
}
}
catch (Exception ex)
{
response.Message = ex.Message;
response.Status = 0;

        }
        return response;
    }

using SkiaSharp

$
0
0

Hi

I am attempting to use a png as background shader for a skiasharp canvas

The code is:

using (Stream stream = assembly.GetManifestResourceStream("RecentAppTest.WoodGrain.png"))
using (SKManagedStream skStream = new SKManagedStream(stream))
using (SKBitmap bitmap = SKBitmap.Decode(skStream))
using (SKShader shader = SKShader.CreateBitmap(bitmap, SKShaderTileMode.Mirror, SKShaderTileMode.Mirror))
{
backgroundFillPaint.Shader = shader;
}

But I get a null value in stream...

The WoodGrain.png file exists in the project as can be seen here

Looking forward to your help

Regards

M.R.


INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2

$
0
0

Hi!

After upgrading to Version 8.7 (build 2037)
I can't distribute my Android APK, it works fine when running on Release-mode thru VS to device but when building APK and trying to install I get
"INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2"

Anybody experienced anythings similar ?

Info (16393) / Finsky: [10916] dda.a(14): Decompressing com.mobisma.Truckify (com.mobisma.Truckify) format 1 Info (16393) / Finsky: [11152] his.run(25): Stored data usage stats for package com.mobisma.Truckify; completed bytes: 21096891. Info (16393) / Finsky: [10916] dda.a(21): com.mobisma.Truckify (com.mobisma.Truckify) (58955507 bytes) copied successfully in 2381 ms Info (16393) / Finsky: [2] ntd.run(14): IT: Removed com.mobisma.Truckify from ResourceManager for copy success. Info (16393) / Finsky: [2] ntf.a(7): IT: Successfully copied APK to update com.mobisma.Truckify (adid: com.mobisma.Truckify , isid: _Z6lTNC_TnuH2_mkbYOVow) Info (16393) / Finsky: [2] nua.b(9): IT: com.mobisma.Truckify to state 40 Info (16393) / Finsky: [10923] nrh.accept(22): IT: starting next download: package=com.mobisma.Truckify Info (16393) / Finsky: [10923] nqz.a(3): Handling streamingComplete for com.mobisma.Truckify gid: 0 Info (16393) / Finsky: [10923] nua.c(56): IT: Begin install of com.mobisma.Truckify (isid: _Z6lTNC_TnuH2_mkbYOVow) Info (16393) / Finsky: [10923] nra.a(188): Installer: Notifying status update. package=com.mobisma.Truckify, status=INSTALLING Info (16393) / Finsky: [10962] odj.b(52): IQ: Notifying installation update. package=com.mobisma.Truckify, status=INSTALLING Info (16393) / Finsky: [2] hub.a(11): Selecting account [g2cNcEkt4qyAHQHQHBj4L4nIXedQdYObSnt3w1p78X4] for package com.mobisma.Truckify. overriding=[true] Info (16393) / Finsky: [2] hub.a(11): Selecting account [g2cNcEkt4qyAHQHQHBj4L4nIXedQdYObSnt3w1p78X4] for package com.mobisma.Truckify. overriding=[true] Info (16393) / Finsky: [2] hub.a(11): Selecting account [g2cNcEkt4qyAHQHQHBj4L4nIXedQdYObSnt3w1p78X4] for package com.mobisma.Truckify. overriding=[true] Info (16393) / Finsky: [2] hub.a(11): Selecting account [g2cNcEkt4qyAHQHQHBj4L4nIXedQdYObSnt3w1p78X4] for package com.mobisma.Truckify. overriding=[true] Info (25196) / Finsky:download_service: [11448] juk.a(20): onRemove(request_id=334, files_to_download=1, group_id=com.mobisma.Truckify, display_data[invisible=false, title=Truckify], network_restrictions=4, status=succeeded, bytes_downloaded=21096891, retry[count=0, next_retry=n/a]) Error (16393) / Finsky: [2] tyc.onReceive(17): Error -504 while installing com.mobisma.Truckify: INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2 Warning (16393) / Finsky: [2] ntx.a(17): IT: Install failure of com.mobisma.Truckify (isid: _Z6lTNC_TnuH2_mkbYOVow): -504, Exception: n/a Warning (16393) / Finsky: [2] nua.a(192): IT: Cleanup running installation of com.mobisma.Truckify (com.mobisma.Truckify) Info (16393) / Finsky: [10909] nrz.run(12): IT: Running resource fetching of com.mobisma.Truckify canceled. Info (16393) / Finsky: [2] nra.b(32): Installer: stopping tracking of task: com.mobisma.Truckify Info (16393) / Finsky: [2] nra.a(188): Installer: Notifying status update. package=com.mobisma.Truckify, status=INSTALL_ERROR Info (16393) / Finsky: [10962] odj.b(52): IQ: Notifying installation update. package=com.mobisma.Truckify, status=INSTALL_ERROR Info (16393) / Finsky: [2] hub.a(11): Selecting account [g2cNcEkt4qyAHQHQHBj4L4nIXedQdYObSnt3w1p78X4] for package com.mobisma.Truckify. overriding=[true] Info (16393) / Finsky: [2] hub.a(11): Selecting account [g2cNcEkt4qyAHQHQHBj4L4nIXedQdYObSnt3w1p78X4] for package com.mobisma.Truckify. overriding=[true] Info (16393) / Finsky: [2] hub.a(11): Selecting account [g2cNcEkt4qyAHQHQHBj4L4nIXedQdYObSnt3w1p78X4] for package com.mobisma.Truckify. overriding=[true] Info (16393) / Finsky: [2] hub.a(11): Selecting account [g2cNcEkt4qyAHQHQHBj4L4nIXedQdYObSnt3w1p78X4] for package com.mobisma.Truckify. overriding=[true]



WebView is not loading URL in UWP

$
0
0

Hello,

I have a simple project in which I load a URL on a WebView. It is working as expected on Android, but on UWP, the WebView doesn't load anything and keep in blank.

It's not a problem of Width/Height as I have changed the background color and I can check it. Furthermore, I tried with a sample project of the docs, and it isn't working too. I don't know what's happening and I can't see nothing in the Output.

I'm using the latest version of Visual Studio 2019 and Xamarin.Forms. Already checked 'Internet Client & Server' Capabilities on UWP properties.

Someone knows what could I do to solve this?

Exception while navigating from App.xaml.cs with Prism and DryLoc (RELEASE ONLY)

$
0
0

Hello,

When I try to run my application in release mode, it only shows a white screen when deployed. I've managed to trace the code from the logs, and I've found that the first navigation is throwing an exception:

**Message: ** Unable to get constructor of Test.Views.LoginPage using provided constructor selector when resolving Test.Views.LoginPage: Object {ServiceKey="LoginPage"} FactoryId=52 IsResolutionCall from Container without Scope
with Rules with {AutoConcreteTypeResolution} and without {UseFastExpressionCompilerIfPlatformSupported}
with Made={FactoryMethod=ConstructorWithResolvableArguments}.

**Stacktrace: **

at DryIoc.Throw.For[T] (System.Boolean throwCondition, System.Int32 error, System.Object arg0, System.Object arg1, System.Object arg2, System.Object arg3) [0x00020] in <0a86de686e464708b60aa6773e19d33b>:0 at DryIoc.ReflectionFactory.CreateExpressionOrDefault (DryIoc.Request request) [0x00066] in <0a86de686e464708b60aa6773e19d33b>:0 at DryIoc.Factory.GetExpressionOrDefault (DryIoc.Request request) [0x0012e] in <0a86de686e464708b60aa6773e19d33b>:0 at DryIoc.Container.DryIoc.IResolver.Resolve (System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, DryIoc.Request preResolveParent, System.Object[] args) [0x001a2] in <0a86de686e464708b60aa6773e19d33b>:0 at DryIoc.Resolver.Resolve (DryIoc.IResolver resolver, System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, System.Object[] args) [0x00000] in <0a86de686e464708b60aa6773e19d33b>:0 at Prism.DryIoc.DryIocContainerExtension.Resolve (System.Type type, System.String name) [0x00006] in <5fe086bb7e8d47c3a9f1c36dce9746ea>:0 at Prism.Ioc.IContainerProviderExtensions.Resolve[T] (Prism.Ioc.IContainerProvider provider, System.String name) [0x00000] in <aadb680bd8e9478189f606fd633a4198>:0 at Prism.Navigation.PageNavigationService.CreatePage (System.String segmentName) [0x00000] in <fe20bbc2e107492eb7c7e45796362bb2>:0

With debug mode, it is working properly. And it isn't a XAML problem as I tried to use an Empty page for navigating.

Xamarin Forms v4.7.0.1080
Prism.Dryloc.Forms v7.2.0.1422

The linking options for release mode are Sdk And User assemblies, and none for debug

Do you have an idea of what could be happening? Or how could I trace deeply to find out which is the problem maybe?

What's the best (easiest) way to get a real-time heart-rate into a Xamarin application?

$
0
0

This is a very general and vague question but I am really struggling to gain any traction onf it. The problem is that I don't have the money to go out buying random fitness devices, to see if I can get them to connect. And I am struggling to see how much overlap (if any) there is between Apple's Health Kit stuff, which seems to be aimed mainly at the Apple Watch, and Google's Fit API.

A bunch of questions spring to mind:

  1. I am assuming that Apple being Apple, I can access an Apple Watch only on an iPhone?
  2. Does Google have a similar restriction, or is there a way - perhaps leveraging the power of Xamarin - to get an iOS app to talk to a Google Fit device?
  3. Do I really have to pay the extortionate £1500 just to experiment with the ANT+ protocol (as used by Garmin)?

I looked at a device that was advertised as being dual Bluetooth BLE / ANT+, but does this simply mean that it uses the ANT+ protocol over Bluetooth? In other words, is there likely to be a way to go in below the ANT+ protocol and just grab raw data over Bluetooth?

Wearables are an exploding market and so I am surprised how difficult it is to find a trustworthy path into this field. Indeed, I can imagine there might be huge obstacles, but I might have expected Xamarin to be making inroads into making this stuff easier to work with.

Any help at all would be like water to a man adrift in the Pacific for a month!

Kind wishes - Patrick

how do i change label text in second page with a button clicked on the first page

$
0
0

hi everyone,
so in my app i have 2 pages and i would like to change the label text in the second page by clicking on a button in the first page.
the label i the second page already contains a text value and i would like to update it only the button is click. i cant seem to figure out how to start. it

first page

second page

WebView controls not working / how to implement scroll and tap

$
0
0

am using web view to display html text on my application. I need the user to be able to scroll and tap the text. However That seems to be close to impossible. TapGesture is just not firing and based on my search its not mistake on my side but seems that since webview its usually used to display web pages and they include buttons to no need for tap gesture. So if i use my custom control it work however i cant scroll the content and if i use scroll around the webview then it doenst work as needed. Once i implemented the custom control i can see then action in my output however the content doesnt move.

public class ExtendedWebView : WebView
{
public ExtendedWebView()
{
}

    public event EventHandler Touched;

    public void OnTouched() =>
    Touched?.Invoke(this, null);
    public ICommand PannedCommand
    {
        set { SetValue(PannedCommandProperty, value); }
        get { return (ICommand)GetValue(PannedCommandProperty); }
    }
    public static readonly BindableProperty PannedCommandProperty = BindableProperty.Create(nameof(PannedCommand), typeof(ICommand), typeof(ExtendedWebView));
}

[assembly: ExportRenderer(typeof(ExtendedWebView), typeof(ExtendedWebViewRenderer))]
namespace AVAT.Droid.Renderers
{
public class ExtendedWebViewRenderer : WebViewRenderer
{
public static int _webViewHeight;
static ExtendedWebView _xwebView = null;
public WebView _webView;
bool isScroll;
public ExtendedWebViewRenderer(Context context) : base(context)
{

    }

    class ExtendedWebViewClient : WebViewClient
    {
        WebView _webView;
        public async override void OnPageFinished(WebView view, string url)
        {
            try
            {
                _webView = view;
                if (_xwebView != null)
                {

                    view.Settings.JavaScriptEnabled = true;
                    await Task.Delay(100);
                    string result = await _xwebView.EvaluateJavaScriptAsync("(function(){return document.body.scrollHeight;})()");
                    _xwebView.HeightRequest = Convert.ToDouble(result);


                }
                base.OnPageFinished(view, url);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");
            }
        }
        public override bool ShouldOverrideUrlLoading(Android.Webkit.WebView view, IWebResourceRequest request)
        {
            return true;
        }
    }

    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)
    {
        base.OnElementChanged(e);
        _xwebView = e.NewElement as ExtendedWebView;
        _webView = Control;

        if (e.OldElement == null)
        {
            _webView.SetWebViewClient(new ExtendedWebViewClient());
        }
        _webView.Touch += (object sender, TouchEventArgs eventArgs) =>
        {

            if (eventArgs.Event.Action == Android.Views.MotionEventActions.Down)
            {
                var webview = Element as ExtendedWebView;

                webview.OnTouched();
            }
        };
        _webView.Touch += _webView_Touch;

        void _webView_Touch(object sender, TouchEventArgs e)
        {
            var webview = Element as ExtendedWebView;
            bool isMove = true;
            Console.WriteLine(e.Event.Action);
            switch (e.Event.Action)
            {
                case Android.Views.MotionEventActions.Down:

                    isScroll = true;
                    break;
                case Android.Views.MotionEventActions.Move:
                    isScroll = true;
                    if (isMove)
                    {
                        isMove = false;
                        webview.PannedCommand?.Execute(null);
                    }
                    break;
                case Android.Views.MotionEventActions.Up:

                    if (!isScroll)
                    {
                        webview.OnTouched();
                    }
                    break;
                default:
                    break;
            }
        }
    }
}

}


Maybe you guys have experience how to implement both controls tap and scroll?

Deployment failure in VS 2019 for Mac - Xamarin issue - error ADB1000: Deployment failed

$
0
0
I am trying to debug an Android application in VS 2019 for Mac using the default Android emulator. The application builds successfully, but then the deployment on the emulator fails with the following error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: Deployment failed /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: System.InvalidOperationException: '/Users/vesi90/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25/bin/jarsigner' exited with code '1': /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: at Xamarin.AndroidTools.PlatformPackage.Exec (System.String step, System.Diagnostics.ProcessStartInfo psi, Xamarin.AndroidTools.IProgressNotifier progressReporter, System.Threading.CancellationToken token) [0x0007d] in /Users/builder/azdo/_work/204/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/PlatformPackage.cs:237 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: at Xamarin.AndroidTools.PlatformPackage.Jarsigner (System.String unsigned, System.String packageDir, Xamarin.AndroidTools.IProgressNotifier progressReporter, System.Threading.CancellationToken token) [0x00057] in /Users/builder/azdo/_work/204/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/PlatformPackage.cs:259 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: at Xamarin.AndroidTools.PlatformPackage.GetPlatformPackagePath (System.Int32 apiLevel, System.String aaptPath, Xamarin.AndroidTools.IProgressNotifier progressReporter, System.Threading.CancellationToken token) [0x00158] in /Users/builder/azdo/_work/204/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/PlatformPackage.cs:127 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.InstallSharedPlatformAsync () [0x00080] in /Users/builder/azdo/_work/204/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:345 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.EnsureCorrectSharedRuntimes () [0x0017d] in /Users/builder/azdo/_work/204/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:266 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.RunAsync (System.Threading.CancellationToken token) [0x001f9] in /Users/builder/azdo/_work/204/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:194 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(616,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.RunLoggedAsync (System.Threading.CancellationToken token) [0x0002f] in /Users/builder/azdo/_work/204/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:119 1 Warning 1 Error

I have installed the Android SDK ver. 9.0. and all the tools for Android development in the installation of VS for Mac. The app is built with Xamarin. The app builds successfully on other Mac's and PC and it's verified that it works.

Please let me know why it fails to deploy using ADB on the emulator.

Which control i need to use for background process in xamarin for enabling and disabling controls

$
0
0

Dear Team,

I am building an geo fencing app using xamarin.forms. Geo location will be created with some radius and allocated to user into our web application.
Based on this allocation when the user entered into that boundary / location, I need to enable the clock-in and clock out button in mobile app, at the same time, while the user left from that region i need to disable that button control again.

How to do this in xamarin.forms. if any one did this logic please help me out or please suggest me which control i need to use to achieve this logic?

Hide the keyboard on Entry focus event

$
0
0

Hi
I want to hide the keyboard when i click on Entry
I was able to do this by set **IsReadOnly ** property to true
Now I want to launch an event when I click on **Entry **

I used this code, but I don't want to disable the control
~~~.

        <StackLayout>
                        <Entry x:Name="myEntry" IsEnabled="False"/>
                        <StackLayout.GestureRecognizers>
                            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" NumberOfTapsRequired="1">
                            </TapGestureRecognizer>
                        </StackLayout.GestureRecognizers>
                    </StackLayout>

~~~

Thank you in advance.

Multiple overlaying profile pictures

$
0
0

Hello Everybody,

I was wondering how you would create such a CollectionView where
you have multiple overlapping profile pictures such as the following example (found it on Stackoverflow)

Thanks for your ideas!

CollectionView's implementation as StaggeredGridLayout problem?

$
0
0

I'm implementing CollectionView as a StaggeredGridLayout and write a custom renderer for it on android as:

[assembly: ExportRenderer(typeof(CollectionView), typeof(CustomCollectionViewRenderer))]
namespace App.Droid
{
public class CustomCollectionViewRenderer : CollectionViewRenderer
{
public CustomCollectionViewRenderer(Context context) : base(context)
{
}

    protected override void OnElementChanged(ElementChangedEventArgs<ItemsView> elementChangedEvent)
    {
        base.OnElementChanged(elementChangedEvent);

        if (elementChangedEvent.NewElement != null)
        {
            StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.Vertical);
            SetLayoutManager(manager);
        }
    }
}

}

It's working fine at the start of the application when initialized, but when i try to update or add more items, the item source of collectionview does not accept any data and becomes empty. It only populate the data template of collectionview at initialization but not after updating.

At initialization :

After updating item source:

  • I have tried by binding it to viewModel and also by directly setting its item source

help need

$
0
0

hello everyone, im new to xamarin. in the app that a developing, the mainpage contains two buttons that navigate to a popup page which contains a label a textbox and a picker. what i want is, when i click on one of the button it should change the label text and picker options in the popup page. ive spent a lot of hours trying to figure it out but nothing.
thank you in advance

Viewing all 204402 articles
Browse latest View live


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