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

How to implement readmore in listview items?

$
0
0

How to implement need readmore and read less inside listview item as it expand and collapse content respectively?


Manifest Corrupt?

$
0
0

Hi
When going to the Manifest page of "project properties" I get the following

An error occurred trying to load the page.
Index was outside the bounds of the array.

How can I get the solution to rebuild the manifest??

Regards

M.R>

I need help with my Firebase Subscribe to a Child with no Key - Newtonsoft.Json error

$
0
0

I have a Firebase Child called "Parameters" that stores some data while my program runs. I populate it with "Put" and "Patch" actions. I cannot get the subscribe to work... I'm stuck on this Newtonsoft.Json.JsonSerializationException and I've tried several things but cannot figure it out. You can see in the error, I am getting the payload back... I just cannot parse it into my ViewParameterModel property variables. I would appreciate any help to get this working. Thanks, Brian

$exception {Firebase.Database.FirebaseException: Exception occured while processing the request.
Request Data: Response: {"aug":true,"fan":true,"ign":false,"mode":"Off","target":200}
---> Newtonsoft.Json.JsonSerializationException: Error converting value True to type 'Chart_sample.ViewParameterModel'. Path 'aug', line 1, position 11.
---> System.ArgumentException: Could not cast or convert from System.Boolean to Chart_sample.ViewParameterModel.

FirebaseHelper.cs

...
private readonly string ChildParams = "ControllerData/Pellet_Pirate_1/Parameters";

        public ObservableCollection<Parameter> GetParameters()
        {
            firebase.Child(ChildParams).AsObservable<ViewParameterModel>().Subscribe(snapp =>
            {
                ViewParameterModel.aug = snapp.Object.aug;
                ViewParameterModel.fan = snapp.Object.fan;
                ViewParameterModel.ign = snapp.Object.ign;
                ViewParameterModel.mode = snapp.Object.mode;
                ViewParameterModel.target = snapp.Object.target;
            });
            return null;
        }
...

ViewParameterModel.cs

    public class ViewParameterModel : INotifyPropertyChanged
    {

        public event PropertyChangedEventHandler PropertyChanged;

        private bool Fan = false;
        public bool fan
        {
            get
            {
                return Fan;
            }
            set
            {
                if (Fan != value)
                {
                    Fan = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("fan"));
                }
            }
        }

        private bool Igniter = false;
        public bool ign
        {
            get
            {
                return Igniter;
            }
            set
            {
                if (Igniter != value)
                {
                    Igniter = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ign"));
                }
            }
        }

        private bool Auger = false;
        public bool aug
        {
            get
            {
                return Auger;
            }
            set
            {
                if (Auger != value)
                {
                    Auger = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("aug"));
                }
            }
        }

        private string Mode = "Off";
        public string mode
        {
            get
            {
                return Mode;
            }
            set
            {
                if (Mode != value)
                {
                    Mode = value;
                    Debug.WriteLine("Mode: " + Mode);
                    if (SegmentBindingContext != null)
                    {
                        SegmentBindingContext.index = Mode.Equals("Off") ? 0 : Mode.Equals("Start") ? 1 : Mode.Equals("Smoke") ? 2 :
                                                    Mode.Equals("Hold") ? 3 : Mode.Equals("Ignite") ? 4 : 5;
                    }
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("mode"));
                }
            }
        }

        private int Target = 0;
        public int target
        {
            get
            {
                return Target;
            }
            set
            {
                if (Target != value)
                {
                    Target = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("target"));
                }
            }
        }

    }

}

how to preserve Source defined ResourceDictionaries?

Monodevelop failing to create packaged application for GTK#

$
0
0

Hi all,

I've added GTK# to my Xamarin.Forms project and it works pretty well :smile:

But I have problem on Linux (I'm using Debian). Application runs well in debug/release mode, but I have problem when I try to create tar.gz file/package for further distribution - it fails no matter what configuration I take.
I'm using latest stable Monodevelop (7.6.9.22)

Does anyone know what's the catch?

Need some guidance on College project

$
0
0

I need some guidance regarding a project for a college course, we have been learning about software's life cycle from Analysis, Design and now Implementation. For our proposed project I wanted to develop somewhat of a Uber clone but with public transportation (In my country public transportation is awful), where users register bus routes and provide information regarding each route. I had proposed using a MERN Stack since I'm a big fan of JS overall but now since we are required to develop this application I can't afford to teach my partners Node.js, Express, MongoDB and React while developing the application (I am not fully an expert myself).
This is why I was planning on migrating our stack in Android, though my partners wish to use Xamarin.Android hence why I am here looking for some information:

  • Are there any UI Frameworks for Xamarin.Android say React Native Papper?
  • How do you apply de MVVM design pattern to Xamarin.Android apps (I have done a couple of small apps in Xamarin.Forms)?
  • Can ASP.NET Core be used to develop the backend? Are there any extra considerations?
  • Since I described how the app works, is using a Google Maps API feasible? I had planned for a route to use multiple stops which are registered by users but since there is a limit to 15 stops I am worried this could be a mayor problem.

Anyone get gRPC.Core v2.29.0 working with Xamarin.Forms v4.6 on iOS?

$
0
0

I get this error:

Error while loading assemblies: /Users/Arthur/Library/Caches/Xamarin/mtbs/builds/eReader.iOS/0f4caf5560de1374ad8f3c28fd86d686/bin/iPhone/Debug/grpc_csharp_ext.x64.dll e-Reader.iOS

My navigation method, appears to go to somewhere else

$
0
0

Hello community

I have two pages, the fist one is going to be the splash screen, with a .git on it.
Ten I have another screen that with a label and that it.

The way that I go from A to B, is that I create a Timer (To simulate the end of the animation)
the when that animation is finished, I create a new Task to navigate to my other screen

It will navigate, but I do not see my label or anything

And if I remove the create a new task, i get this Android.Util.AndroidRuntimeException: 'Only the original thread that created a view hierarchy can touch its views.'


Why is the rotated image being drawn?

$
0
0

Greetings friends, I am developing an app where the user browses on their device to select an image and this is drawn on a canvas, I am using skiasharp for this, the problem is that I use the app on a Redmi I notice 8 and it works well but I use it on a Galaxy E7 android 5.1 and rotate the image draws it horizontally, I am using images with 90 degree rotation metadata but in the redmi everything is fine I do not understand why this happens in the galaxy E7, I appreciate any help

    `if (libraryBitmap.Height > libraryBitmap.Width)
            {
                canvasView2.HeightRequest = 400;
                canvasView2.WidthRequest = 1000;
            }
            else
            {
                canvasView2.HeightRequest = 300;
                canvasView2.WidthRequest = 1000;
            }
            libraryBitmap_heigth = libraryBitmap.Height;
            libraryBitmap_width = libraryBitmap.Width;
            float left = 0;
            float top = 0;
            float right = info.Width;
            float bottom = info.Height;
            SKRect rect = new SKRect(left, top, right, bottom);
            App.ScreenHeight = info.Height;
            App.ScreenWidth = info.Width;

            canvas.DrawBitmap(libraryBitmap, rect);`

Unhandled exception: System.ComponentModel.Win32Exception (0x80004005)

TapGestureRecognizer is not working for ScrollView And CollectionView

$
0
0

I am facing an issue with TapGestureRecognizer, I tried various solution for it but nothing worked. I am sharing my code snippets.

If I comment the scroll view it is working fine but for refresh view we need scroll view and when I uncomment this scrollview code, tapgesture stopped working.

        <StackLayout Padding="0" Margin="20,20,20,20" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                <RefreshView IsRefreshing="{Binding IsBusy, Mode=OneWay}" Command="{Binding RefreshCleaningListCommand}">
                    <!--<ScrollView InputTransparent="True" VerticalScrollBarVisibility="Never" Orientation="Vertical">-->
                        <StackLayout BindableLayout.ItemsSource="{Binding CleaningList}">
                            <BindableLayout.ItemTemplate>
                                <DataTemplate>
                                    <StackLayout Margin="0, 0, 0, 15">
                                        <Frame 
                                                HorizontalOptions="StartAndExpand" 
                                                VerticalOptions="StartAndExpand"
                                                Padding="10,20,0,10" 
                                                HasShadow="False"
                                                IsClippedToBounds="True" BackgroundColor="#ffffff" CornerRadius="15" >
                                            <views:CleaningListDataTemplate></views:CleaningListDataTemplate>
                                        </Frame>
                                    </StackLayout>
                                </DataTemplate>
                            </BindableLayout.ItemTemplate>
                        </StackLayout>
                    <!--</ScrollView>-->
                </RefreshView>
                <StackLayout.GestureRecognizers>
                    <TapGestureRecognizer NumberOfTapsRequired="1" Command="{Binding HideCalendarViewCommand}"/>
                </StackLayout.GestureRecognizers>
            </StackLayout>

Also If I use collection view, inside refresh view then also Tap gesture is not working It is not working with collection view.

    <StackLayout Padding="0" Margin="20,20,20,20" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                <RefreshView IsRefreshing="{Binding IsBusy, Mode=OneWay}" Command="{Binding RefreshCleaningListCommand}">
                    <CollectionView ItemsSource="{Binding CleaningList}">
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <StackLayout Margin="0, 0, 0, 15">
                                    <Frame 
                                            HorizontalOptions="StartAndExpand" 
                                            VerticalOptions="StartAndExpand"
                                            Padding="10,20,0,10" 
                                            HasShadow="False"
                                            IsClippedToBounds="True" BackgroundColor="#ffffff" CornerRadius="15" >
                                        <views:CleaningListDataTemplate></views:CleaningListDataTemplate>
                                    </Frame>
                                </StackLayout>
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                    </CollectionView>
                </RefreshView>
                <StackLayout.GestureRecognizers>
                    <TapGestureRecognizer NumberOfTapsRequired="1" Command="{Binding HideCalendarViewCommand}"/>
                </StackLayout.GestureRecognizers>
            </StackLayout>

Every suggestion will be appreciated.

PhoneDialer adds 835 in front of number.

$
0
0

I am using PhoneDialer with xamarin essential. I found 835 concatenated before phone numbers only on some devices. Some samsung users figured this out and I saw this on AOSP Android 10 based Lineage OS as well.

Error build on Iphone after update

$
0
0

Yesterday i update my iphone to version 13.4.1

Sinds then i have an error building to my Iphone in visualstudio for Mac ( image Catalina)

I know the free space is below the 3 gigabyte because then there is a warning , but is it the update or the free space that is to little ?

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(3,3): Error MSB4018: The "EmbedMobileProvision" task failed unexpectedly.
System.Exception: Did not find XML plist in buffer.
  at Xamarin.MacDev.PDictionary.FromBinaryXml (System.Byte[] array) [0x0002c] in <d570b8d8ffe74cd4b8f1635c165d955d>:0 
  at Xamarin.MacDev.MobileProvision.LoadFromFile (System.String fileName) [0x0000e] in <d570b8d8ffe74cd4b8f1635c165d955d>:0 
  at Xamarin.iOS.Tasks.EmbedMobileProvisionTaskBase.Execute () [0x000eb] in <d570b8d8ffe74cd4b8f1635c165d955d>:0 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:574 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:814  (MSB4018) (OFB.iOS)



How to re-order items in recyclerview ?

$
0
0

I am new to Xamarin and write code for hobby.
I have a list of items(ListselectedItems) which is a union of items saved(id>0) and not saved(id=0) sorted in descending order by field "id" displayed in a recyclerview. It works correctly and items are displayed in desired order on start.
Sequence of events later :

  • User taps an item
  • dialog pops up with edit text to update the item quantity
  • item saved to database
  • id updates to new value (notifyitemchanged--changes are visible on screen)
  • re-order the items (move this item above first not saved item)

                    item.ItemQty = qty;
                    await helper.SaveServicetem(item);
                    selectedItemAdapter.NotifyItemChanged(itemposition);
                    selectedItems.Sort((x, y) => (y.ItemID.CompareTo(x.ItemID)));
    

NotifyDataSetChanged() works but the animation of item movement is lost( if both the types of items saved and unsaved ones are visible on screen)
I am stuck on last step.
How to deploy NotifyItemMoved() as it will involve movement of multiple items and sync with the underlying recyclerview source (List)?

Can any one please can help me with my problem with BindingContext?

$
0
0

Hi, everyone I need help for my problem. I am trying to bind the context from the viewmodel like this

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

and also I have a constructor inside my view model that it have some parameters on it, here its starts the problem because when I try to bind it appears this message Type 'Type BLEConnectViewModel' is not usable as an object element because is not public or does not define a public parameterless constructor or a type converter. No default constructor found.

And the constructor is like this: I am using Prism container.

public BLEConncetViewModel(INavigationService navigationService, IAdapter btAdapter)
{
_navigationService = navigationService;
_btAdapter = btAdapter;
_btAdapter.DeviceDiscovered += OnDeviceDiscovered;
OnClickCommand = new DelegateCommand(OnClick);

    }

Thanks.


Collapsing Toolbar Layout in Xamarin Forms

Check battery

$
0
0

Hello

How can I find because my App spend a lot of battery device ?

thanks.

Firebase Smart Reply not working on Xamarin.Android

$
0
0

Hi! I am trying to use Firebase Smart Reply in my Xamarin.Android project. I followed the Firebase Guide and set it up in my project. However, it is not working and throws an exception whenever I call the SuggestReplies() function. I'm using Visual Studio 2019 16.6.0 version.

I've added following Nuget packages for Smart Reply:
<PackageReference Include="Xamarin.Firebase.ML.Natural.Language"> <Version>122.0.0-preview02</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.ML.Natural.Language.Id.Model"> <Version>120.0.7-preview02</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.ML.Natural.Language.Model"> <Version>120.0.7-preview02</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.ML.Natural.Language.Smart.Reply"> <Version>118.0.7-preview02</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.ML.Natural.Language.Smart.Reply.Model"> <Version>120.0.7-preview02</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.ML.Natural.Language.Translate"> <Version>122.0.0-preview02</Version> </PackageReference>

Also added following to disable compression of Smart Reply's model file:
<AndroidStoreUncompressedFileExtensions>.tflite;tflite</AndroidStoreUncompressedFileExtensions>

However, it throws the following exception on running:
com.google.firebase.ml.common.FirebaseMLException: Failed to generate smart reply

Also, the console logs show these lines before the exception is thrown:
I/mono-stdout( 6829): Log: SmartReply Test 5 - Conversation
W/monodroid-assembly( 6829): typemap: unable to find mapping to a managed type from Java type 'com/google/android/gms/tasks/zzu'
I/mono-stdout( 6829): Log: 2nd call
I/mono-stdout( 6829): Log: Start Time: 5/23/2020 7:11:27 PM
W/monodroid-assembly( 6829): typemap: unable to find mapping to a managed type from Java type 'com/google/android/gms/tasks/zzu'
W/monodroid-assembly( 6829): typemap: unable to find mapping to a Java type from managed type 'System.Int32, mscorlib'
W/monodroid-assembly( 6829): typemap: unable to find mapping to a Java type from managed type 'System.Int32, mscorlib'
D/Mono ( 6829): DllImport searching in: '__Internal' ('(null)').
D/Mono ( 6829): Searching for 'java_interop_jnienv_is_assignable_from'.
D/Mono ( 6829): Probing 'java_interop_jnienv_is_assignable_from'.
D/Mono ( 6829): Found as 'java_interop_jnienv_is_assignable_from'.

I/tflite ( 6829): Initialized TensorFlow Lite runtime.Initialized TensorFlow Lite runtime.

W/monodroid-assembly( 6829): typemap: unable to find mapping to a Java type from managed type 'System.Int32, mscorlib'
E/ModelResourceManager( 6829): Error preloading model resource
E/ModelResourceManager( 6829): com.google.firebase.ml.common.FirebaseMLException: Couldn't open language detection model file

E/ModelResourceManager( 6829): at com.google.firebase.ml.naturallanguage.languageid.internal.LanguageIdentificationJni.zzl(com.google.firebase:firebase-ml-natural-language@@22.0.0:23)
E/ModelResourceManager( 6829): at com.google.firebase.ml.naturallanguage.languageid.FirebaseLanguageIdentification$zzb.zzl(com.google.firebase:firebase-ml-natural-language@@22.0.0:6)
E/ModelResourceManager( 6829): at com.google.android.gms.internal.firebase_ml_naturallanguage.zzde.zzf(com.google.firebase:firebase-ml-natural-language@@22.0.0:53)
E/ModelResourceManager( 6829): at com.google.android.gms.internal.firebase_ml_naturallanguage.zzde$zza.zzdn(com.google.firebase:firebase-ml-natural-language@@22.0.0:7)
E/ModelResourceManager( 6829): at com.google.android.gms.internal.firebase_ml_naturallanguage.zzde$zza.call(com.google.firebase:firebase-ml-natural-language@@22.0.0:24)
E/ModelResourceManager( 6829): at com.google.android.gms.internal.firebase_ml_naturallanguage.zzco.zza(com.google.firebase:firebase-ml-natural-language@@22.0.0:31)
E/ModelResourceManager( 6829): at com.google.android.gms.internal.firebase_ml_naturallanguage.zzcr.run(Unknown Source:4)
E/ModelResourceManager( 6829): at android.os.Handler.handleCallback(Handler.java:873)
E/ModelResourceManager( 6829): at android.os.Handler.dispatchMessage(Handler.java:99)
E/ModelResourceManager( 6829): at com.google.android.gms.internal.firebase_ml_naturallanguage.zzb.dispatchMessage(com.google.firebase:firebase-ml-natural-language-smart-reply@@18.0.7:6)
E/ModelResourceManager( 6829): at android.os.Looper.loop(Looper.java:193)
E/ModelResourceManager( 6829): at android.os.HandlerThread.run(HandlerThread.java:65)
E/ModelResourceManager( 6829): Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
E/ModelResourceManager( 6829): at android.content.res.AssetManager.nativeOpenAssetFd(Native Method)
E/ModelResourceManager( 6829): at android.content.res.AssetManager.openFd(AssetManager.java:768)
E/ModelResourceManager( 6829): at com.google.firebase.ml.naturallanguage.languageid.internal.LanguageIdentificationJni.zzl(com.google.firebase:firebase-ml-natural-language@@22.0.0:11)
E/ModelResourceManager( 6829): ... 11 more
W/monodroid-assembly( 6829): typemap: unable to find mapping to a Java type from managed type 'Android.Text.IInputFilter, Mono.Android'
W/FirebaseSmartReply( 6829): Failed to identify the language for the conversation
I/chatty ( 6829): uid=10090(com.kapildhaimade.) FirebaseMLHandl identical 3 lines
W/FirebaseSmartReply( 6829): Failed to identify the language for the conversation

I haven't been able to get it to run after much troubleshooting. I also tried to access the Smart Reply model asset file 'hobbes.tflite' using Assets.Open() and it worked.
Any idea how I can get this running? Thank you for the help :smile:

Xamarin.Forms iOS application works correctly in Debug mode, but does not in Release

$
0
0

Hello everyone!
I am having an issue with my Xamarin.Forms iOS application which I can not seem to handle myself.
So my app works perfectly correct in Debug mode, but fails in Release mode.
This is a PCL + Android + iOS app, and all configurations work correctly, except for iOS release one (what I mean is that Android release configuration works correctly).
The fact that I can not debug a release build makes it extra hard to investigate what exactly is going wrong under the hood.

The first thing that you can see different in the app in Release mode from Debug is that it has problems with displaying text in labels or buttons:

DEBUG:

RELEASE:

And there are also other errors appearing all over the place.
For example, I have random error handlers here and there, and one of them gave me this error message. I think this one might probably be usefull in this investigation:

It says that it can not find a constructor for one of the models (it definitely can find one in DEBUG mode)

I don't have a single 'debug' or 'release' reference in the code, so I assume that this is a Xamarin.Forms bug

Draw Arabic Text using Skiasharp

$
0
0

Hi,

I'm trying to render Arabic text using Skiasharp, with no success. The characters are rendered disconnected and from left to right, please see the image below.

Any help would be appreciated, preferably without any special font or custom renderer...etc.

Thanks,

Viewing all 204402 articles
Browse latest View live


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