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

Xamarin.Android Crash on BluetoothLeScanner.StartScan

$
0
0

During testing Bluetooth application, I have cautch the following exception System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.' on call:

BluetoothLeScanner.StartScan

... It is very strange, and I even do not know where it is thrown ...

Have anyone faced with the same issue ?


Page loaded event?

$
0
0

Is there a good way to make your own page loaded event. I'm having an issue on android where if I build a table dynamically before the page is fully loaded (displayed) on the device that as you scroll, the content that is off screen disappears.

If I add the content while the pages is already fully loaded everything works correctly.

App Store Connect (Application Loader) publishing failed - Failed to parse altool output.

$
0
0

I'm getting an error when trying to publish an update to my app using the Application Loader on VS. I tried researching on the error but the error itself isn't really clear. It originally worked earlier, but I got a "missing Info.plist value. CFBundleIconName is missing in the bundle" so I simply migrated to asset catalog (didn't use asset catalog for icons before) and now I'm getting this error. I cannot copy and paste the error but a picture of the error can be found below.

Native linking failed error in xamarin for GoogleSign

$
0
0

I am following this tutorial for GoogleSign in my project. https://www.pujolsluis.com/google-client-plugin-for-xamarin/ .Works fine in android. But getting Native linking failed errors while rebuild in ios.

Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseInstanceID'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseNanoPB'
Native linking failed. Please review the build log.
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseCoreDiagnostics'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseAnalytics'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/GoogleSignIn'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseCore'

Deleted bin and obj folders in both mac and visualstudio; clean and rebuid; still error persists.Please help..

send files using bluetooth in xamarin forms ios and android

$
0
0

hello guys,

i am currently doing project for file transfer using Bluetooth between two device using xamarin forms(.net standard) but i cant find relevant documentation for how to do this i know there is a plugin for data transfer https://github.com/aritchie/bluetoothle but i am not sure if it can transfer files please help me out on this.

thanks in advance.

Best way to set a bound Picker SelectedIndex

$
0
0

Hello,
I have bound a Picker SelectedIndex to a public property of the ViewModel.
But when the user wants to edit an item of the model, he opens the page. Then I have to set the picker SelectedIndex to the value of the property of the item edited.
So I need to prevent the property to be modified by the Picker.
This is how I do. Is it the good way?

        private bool getPickerStarsSelectedIndex = false;
        public int PickerStarsSelectedIndex
        {
            get
            {
                getPickerStarsSelectedIndex = true;
                if (_currentSight.StarID > 0)
                    return convertStarIDtoPickerStarsSelectedIndex(_currentSight.StarID);
                else
                    return 0;
            }
            set
            {
                if (getPickerStarsSelectedIndex)
                    getPickerStarsSelectedIndex = false;
                else
                    _currentSight.StarID = convertPickerStarsSelectedIndexToStarID(value);
            }
        }

Issue with Android 10

$
0
0

I've been experiencing this issue with my current app after setting target framework to android:targetSdkVersion="29". I've double checked that this happens with a sample application for easier debugging. This is replicated with the WorkingWithNavigation sample app.

Anytime a page is pushed or popped off the navigation stack this error occurs. I'm assuming this has to do with the animation of the navigation.
Any ideas or thoughts on how to fix this issue?

11-09 11:57:51.138 W/avigation.Droi(18447): Accessing hidden field Landroid/view/animation/Animation;->mListener:Landroid/view/animation/Animation$AnimationListener; (greylist-max-p, reflection, denied)
11-09 11:57:51.139 E/FragmentManager(18447): No field with the name mListener is found in Animation class
11-09 11:57:51.139 E/FragmentManager(18447): java.lang.NoSuchFieldException: No field mListener in class Landroid/view/animation/Animation; (declaration of 'android.view.animation.Animation' appears in /system/framework/framework.jar!classes3.dex)
11-09 11:57:51.139 E/FragmentManager(18447): at java.lang.Class.getDeclaredField(Native Method)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.getAnimationListener(FragmentManager.java:1301)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.setHWLayerAnimListenerIfAlpha(FragmentManager.java:1283)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.completeShowHideFragment(FragmentManager.java:1746)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1822)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Handler.handleCallback(Handler.java:883)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Handler.dispatchMessage(Handler.java:100)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Looper.loop(Looper.java:214)
11-09 11:57:51.139 E/FragmentManager(18447): at android.app.ActivityThread.main(ActivityThread.java:7356)
11-09 11:57:51.139 E/FragmentManager(18447): at java.lang.reflect.Method.invoke(Native Method)
11-09 11:57:51.139 E/FragmentManager(18447): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
11-09 11:57:51.139 E/FragmentManager(18447): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

CollectionView.EmptyView is not showing despite count of items is 0.

$
0
0

Gathered from the documentation:

EmptyView, of type object, the string, binding, or view that will be displayed when the ItemsSource property is null, or when the collection specified by the ItemsSource property is null or empty. The default value is null.

So, im working on a Xamarin Forms app which only has the Android Module right now, I wanted to display a message like the example shown in the documentation by just providing the value of EmptyView like this:

EmptyView="No combos to display. Why don't you add some?"

This is added in the following code:

<CollectionView ItemsSource="{Binding ComboList}" 
               IsGrouped="True" SelectionMode="None"
               EmptyView="No combos to display. Why don't you add some?"
                           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}">
                    <CollectionView.Header>
                        <StackLayout>
                            <Label Text="{xt:Translate character_facing_right}"
                                   Margin="{StaticResource HeaderLabelMargin}"
                                   FontSize="Medium"
                                   HorizontalOptions="Center"/>
                        </StackLayout>
                    </CollectionView.Header>
                    <CollectionView.GroupHeaderTemplate>
                         ...
                    </CollectionView.GroupHeaderTemplate>
                    <CollectionView.ItemTemplate>
                        <DataTemplate x:DataType="models:ComboView">
                            <controls:ComboItem Title="{Binding Title}"
                                                Combo="{Binding Combo}"
                                                IsStock="{Binding IsStock}"
                                                Type="{Binding Type}"
                                                UniqueId="{Binding UniqueId}"
                                                Comment="{Binding Comment}"/>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                    <CollectionView.Footer>
                        ...
                    </CollectionView.Footer>
                </CollectionView>

However, when testing, i can see the header of my list but not the EmptyView, even though the list is empty. What am i missing?


Toolbar menu item customization

$
0
0
I would like to load image url to tool bar menu item. BUT from Google results I found that tool bar menu item accept only drawable image. Is there any possibility to load image url


Icon =Accepting only drawable image.

Requirement

Icon = load image url or font awesome icon.

How to put two or more text in a same label?

$
0
0

I want to put in the same label something like this --> $ 300.56 where this symbol "$" its always a constant and just the number change with {Binding Price} for example. Can I do something like that? or just have to use to different labels, one for the symbol and the other for the price(??

EfganHuseynov

$
0
0

in 1st Xaml Page selected Picker item (Country) I want to Bind 3rd Xaml Page ...
Please help me!!

Mono.AndroidTools.RequiresUninstallException: The installed package is incompatible.

$
0
0

When I change the target version from android 9 to 10, everything works fine deploying on a device hasn't got the previous version of the app but I have on my phone installed previous version and I am getting below error message.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(607,2): error ADB1000:  Deployment failed
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(607,2): error ADB1000: Mono.AndroidTools.RequiresUninstallException: The installed package is incompatible. Please manually uninstall and try again.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(607,2): error ADB1000:   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00136] in /Users/runner/runners/2.159.2/work/1/s/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:339 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(607,2): error ADB1000:   at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass95_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/runner/runners/2.159.2/work/1/s/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:753 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(607,2): error ADB1000:   at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <8786ba7ca96d408c8c0d5c5e15ea3164>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(607,2): error ADB1000:   at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-08/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(607,2): error ADB1000: --- End of stack trace from previous location where exception was thrown ---

anyone else seeing this error. it worries me if I make a new release on google play store and existing users will not able to update the app.
I found below report but I am not sure if that should be VS 2019 issue or Xamarin issue.

https://developercommunity.visualstudio.com/content/problem/790804/marjor-issue-on-new-builds.html

Xamarin.forms Firebase analystics.

$
0
0

I have implemented Firebase analytics tool in Xamarin.forms application, and i unable to create custom event

**public partial class FeedPage : ContentPage
{
IFirebaseAnalytics eventTracker;
public FeedPage()
{
InitializeComponent();
eventTracker = DependencyService.Get();
}

    void Handle_Clicked(object sender, System.EventArgs e)  
    {  
        eventTracker.SendEvent("Click1");   // Custom event 
    }  
}**

This custom event throw the error System.NullReferenceException: 'Object reference not set to an instance of an object.'

why navigation between pages in xamarin forms is slow on Android

Get file path from content.

$
0
0

Hi everyone,

I have a Xamarin.Forms (iOS, Android) app and I open it as option to Open PDF documents. For Android app, I set an intent-filter with mimetype: pdf.

  <intent-filter>
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <data android:mimeType="application/pdf" />
        </intent-filter>

Is there any way to do the same thing on iOS?

And I have another problem. After I open my app, I want to retrieve the file's path from intent, but I get something like that:
content://com.android.providers.downloads.documents/document/22

Is there any way to get the file path from that content?

Thank you.


Shell MenuItem binding problem

$
0
0

Hi all.
My Label in Shell MenuItemTemplate can't see property from ViewModel (last item in XAML)

<?xml version="1.0" encoding="UTF-8"?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms" 
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:d="http://xamarin.com/schemas/2014/forms/design"
       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
       mc:Ignorable="d"
       xmlns:views="clr-namespace:BillingMobile.Views"
       xmlns:markupextensions="clr-namespace:BillingMobile.Xaml.MarkupExtensions"
       xmlns:materialIcons="clr-namespace:BillingMobile.Icons"
       xmlns:rounded="clr-namespace:BillingMobile.Controls.Rounded"
       Title="BillingMobile"
       x:Class="BillingMobile.AppShell"
       Style="{DynamicResource BaseStyle}">

    <FlyoutItem Title="Меню" FlyoutDisplayOptions="AsSingleItem" FlyoutIcon="wallet.png">
        <Tab Title="{markupextensions:TranslateExtension Wallet}" Icon="wallet.png">
            <ShellContent ContentTemplate="{DataTemplate views:AccountPage}" />
        </Tab>
        <Tab Title="{markupextensions:TranslateExtension MyCompany}" Icon="account_group.png">
            <ShellContent Title="{markupextensions:Translate Services}" ContentTemplate="{DataTemplate views:AccountPage}" />
            <ShellContent Title="{markupextensions:Translate Users}" ContentTemplate="{DataTemplate views:AccountPage}" />
            <ShellContent Title="{markupextensions:Translate Departments}" ContentTemplate="{DataTemplate views:AccountPage}" />
        </Tab>
        <Tab Title="{markupextensions:TranslateExtension Notifications}" Icon="bell_ring.png">
            <ShellContent ContentTemplate="{DataTemplate views:AccountPage}" />
        </Tab>
    </FlyoutItem>

    <Shell.FlyoutHeader>
        <Grid Padding="15">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Image Grid.Row="0" HeightRequest="70" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="70" x:Name="image">
                <Image.Source>
                    <FontImageSource FontFamily="{DynamicResource MaterialFontFamily}" Glyph="{x:Static materialIcons:MaterialDesignIcons.AccountCircle}" Size="70" Color="{StaticResource PrimaryColor}"/>
                </Image.Source>
            </Image>
            <Label Grid.Row="1" Text="Кравченко Ігор Андрійович" FontAttributes="Bold" TextColor="{StaticResource PrimaryColor}"/>
            <Label Grid.Row="2" Text="{Binding SelectedTheme}" TextColor="{StaticResource PrimaryColor}"/>
        </Grid>
    </Shell.FlyoutHeader>

    <MenuItem>
        <Shell.MenuItemTemplate>
            <DataTemplate>
                <StackLayout Orientation="Horizontal" Padding="15">
                    <Image Grid.Row="0" HeightRequest="24" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="24">
                        <Image.Source>
                            <FontImageSource FontFamily="{DynamicResource MaterialFontFamily}" Glyph="{x:Static materialIcons:MaterialDesignIcons.Brush}" Size="24" Color="{StaticResource PrimaryColor}"/>
                        </Image.Source>
                    </Image>
                    <Label PropertyChanged="OnLabelPropertyChanged" Text="{Binding ThemeTitle}" VerticalOptions="Center" VerticalTextAlignment="Center" TextColor="Black"/>                       
                </StackLayout>
            </DataTemplate>
        </Shell.MenuItemTemplate>
    </MenuItem>
</Shell>

ViewModel:

public class ShellViewModel : BaseViewModel
    {
        public string ThemeTitle
        {
            get { return "Light"; }
        }

        public ShellViewModel()
        {

        }        
    }

The text in Label is always empty.
BUT!
In method OnLabelPropertyChanged I see how the text is binded to label.

Another BUT
When I set Text without binding all works:

<Label PropertyChanged="OnLabelPropertyChanged" Text="Light" VerticalOptions="Center" VerticalTextAlignment="Center" TextColor="Black"/>

I am using Xamarin 4.3.0.819712-pre2

The type or namespace name 'Android' does not exist in the namespace 'Xamarin.Forms.Platform'

$
0
0

Hi guys.
I Updated my nuget packages few days ago to new versions.
but my Android project has 2 errors in MainActivity.cs:
1:
The type or namespace name 'Android' does not exist in the namespace 'Xamarin.Forms.Platform' (are you missing an assembly reference?) Sama.SamaApp.Android MainActivity.cs

2:
'MainActivity.OnCreate(Bundle)': no suitable method found to override MainActivity.cs

i search it in google and find solutions.

But i tested all solutions in two up links but not worked for me.
i tested clear nuget and dotnet caches . removing bin & obj folders . restore nuget packages . remove and reinstall Xamarin.Forms .finally clean rebuilding the solution.
But I could not fix it.
thanks...

Best way to implement an ObservableCollection whose objects are accessible from multiple views?

$
0
0

I am fairly new to Xamarin. I'm currently working on a project and am trying to use best MVVM practices in building it. I've successfully implemented the MVVM pattern for my login page and I have a pretty good grasp on that, but it is a little more straight forward than what I'm trying to do now.

Once you log in you're brought to a TabbedPage. The TabbedPage contains two ContentPages, one with a ListView. My goal is to create an ObservableCollection which can be accessed by both of the ContentPages in the TabbedPage but I'm not sure where the correct place to create this ObservableCollection would be.

Should I create a ViewModel for the TabbedPage and have the ObservableList live there and have the ViewModels for the two ContentPages access that ViewModel? Should I create the ObservableList in the ViewModel of the first ContentPage with the ListView and have the second ContentPage reference that ViewModel?

I've tried looking for resources to understand this particular scenario but I haven't been able to find any that discuss multiple views referencing the same ObservableList. I'd be very grateful for either an explanation on the best way to do this, or a link to a resource that would explain or exemplify this. Thanks!

I should also note that I currently have the ObservableList living in the code behind for the ContentPage with the ListView. I know this is not where it should be but I just wanted to make sure I could get the ListView working with an ObservableList and I am now looking to move it to where it should be.

Custom base App Class

$
0
0

Hello all,

is there any way to derive the App class from a custom base class (of course that inherits from Xamarin.Forms.Application)?

I'm using visual studio and the autogenerated code in App.xaml.g.cs always refer to a global::Xamarin.Forms.Application no matter what I try to do?

Any advice?

Center frame in a tablet screen

$
0
0

How to have a frame centered in the screen. The frame will have only a Label, an Entry of maximum 6 numbers width and a button.

Viewing all 91519 articles
Browse latest View live


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