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

Database != Table. SQLite to separate database to table declarations


What would cause the TabbedPage to show a drop-down selection?

$
0
0

I have a Shared Xamarin Forms app where I use compile directives to show ads.

I have two android projects (one with ads and one without) where I make heavy use of linked files to share code.

I am surprised that the app without ads is showing tabbed spaced across the top where the app with ads is showing a drop-down selection for the different tabs. See the attached images to see how this is represented on the same emulator.

Before I start the time-grinding isolation effort I want to get some thoughts on what could be causing this behavior. FYI - the image sizes for launcher are both 72x72 and I "fingerprinted" them to know that they are both coming from drawable-hdpi

Thanks for your time, Paul

Master details page with dynamic menu list

$
0
0

Hi all,
I would like to change the menu items in master detail page dynamically (i.e.,) Initially I am having 3 menu items on login page, Once user is successfully logged in, i want the menu with 4 items?

MasterPage. xaml

MasterPage.xaml.cs

public partial class MasterPage : ContentPage
{
public ListView listView { get { return lstScreens; } }
public MasterPage()
{
InitializeComponent();

        var masterpageItem = new List<ClassFiles.MasterPageItem>();
        masterpageItem.Add(new ClassFiles.MasterPageItem
        {
            Title="Login",
            TargetType = typeof(Pages.LoginPage)
        });

        masterpageItem.Add(new ClassFiles.MasterPageItem
        {
            Title = "Register",
            TargetType = typeof(Pages.RegisterPage)
        });

        masterpageItem.Add(new ClassFiles.MasterPageItem
        {
            Title = "Menu Item 1",
            TargetType = typeof(Pages.MenuPage1)
        });
        listView.ItemsSource = masterpageItem;
    }

Note:
I got the following reference https://stackoverflow.com/a/37742273. I don't understand the answer posted.

Thanks in advance

After Updating Xamarin studio to Visual Studio 2017 code giving error in Xamarin form Android

$
0
0

After Updating Xamarin studio to Visual Studio 2017 code giving error in Xamarin form Android (IOS code work fine in VS2017) ?

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error MSB4018: The "ResolveLibraryProjectImports" task failed unexpectedly.
This is an unhandled exception from a task -- PLEASE OPEN A BUG AGAINST THE TASK OWNER.
System.IO.FileNotFoundException: Could not load assembly 'Crashlytics.Droid, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Crashlytics.Droid.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x000c2] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:225
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (System.String fullName, Mono.Cecil.ReaderParameters parameters) [0x00001] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:170
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (System.String fullName) [0x00001] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:165
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly (System.String fileName) [0x00001] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:160
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res, System.Collections.Generic.ICollection1[T] jars, System.Collections.Generic.ICollection1[T] resolvedResourceDirectories, System.Collections.Generic.ICollection1[T] resolvedAssetDirectories, System.Collections.Generic.ICollection1[T] resolvedEnvironments) [0x001f2] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/ResolveLibraryProjectImports.cs:197
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute () [0x000e7] in /Users/builder/data/lanes/4695/9dbc4c53/source/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/ResolveLibraryProjectImports.cs:76
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x0002a] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/msbuild-15.0/src/XMakeBuildEngine/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:632
at Microsoft.Build.BackEnd.TaskBuilder+d__26.MoveNext () [0x002bf] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/msbuild-15.0/src/XMakeBuildEngine/BackEnd/Components/RequestBuilder/TaskBuilder.cs:787 (MSB4018) (DMS-Live.Droid)

Xamarin.Forms Android app works in Debug, fails in Release

$
0
0

App opens briefly with blank page, then crashes out with "Unfortunately has stopped", without providing any debug information in the output. I've tried numerous cleanings deleting bin/obj, etc. no luck. Deploy works (usually). Debug seems to work fine. How can I proceed?

SIP for PCL iOS/Android/UWP

$
0
0

I am trying to build an app that utilizes SIP in a Xamarin.Forms PCL app for iOS, Android, and Windows 10 UWP. Does anyone know of a library that covers PCL or at least covers all three platforms? I can find it for Android and iOS, but none so far for UWP.

I have looked at the following Libraries, if I missed something on one of these please let me know!
PortSIP
OZEKI VoIP SDK
SIP.NET
PJSIP.Interop

PJSIP.Interop got me the closest, as in the Nougat package installed on all platforms, but UWP will not compile. UWP seems to be the biggest hurdle for finding a complete SIP library. Is there a SIP API built into .NET Core or something that I can plug into?

Need to be able to register, VoIP, IM, more is always better

Thanks!

Unfocused event in DatePicker iss not handling the cancel button?

$
0
0

I have a icon on tapping of which Date Picker gets open ,I've made all the related bindings and handled the event. I also have Unfocused event which unfocus the Date Picker. So what happens is everytime I tap on the icon, date picker gets open andd whenever I press OK button in picker it take me to Unfocused event but on Pressing it doesnt redirected me to Unfocused event and also icon is no more tappable now so either re navgate to this page will make the icon tappable again.
Any idea why this is happening with Cancel button only ?

OnDisappearing not called on iOS for TabbedPage

$
0
0

I noticed that OnDisappearing is not called on iOS for a TabbedPage. Bug?
Happens on 1.3.0 with classic iOS API.


KeyPress event for xamarin forms

$
0
0

Hi, is there any sample to write KeyPress Event for entry using CustomRenderer.
Thank you.

GestureRecognizer is not working on android using Xamarin.forms

$
0
0

public void EnableSubmitButton(){
LeftMenuItem.IsEnabled = true;
TapGestureRecognizer OnLeftMenuItemClicked = new TapGestureRecognizer ((s,e) => {
OnSubmitClicked (s,e);
});
LeftMenuItem.GestureRecognizers.Add (OnLeftMenuItemClicked);
}

This is the code which is used to add gesture recognizer into the Image. It's working on iOS perfectly. But In android OnLeftMenuItemClicKed is not triggered.

Thanks in Advance.

Changing Target SDK For Android

$
0
0

Hello,

I tried on VS Mac to create a new blank Xamarin.Forms project, and get the error below for Android when packaging.

My question:
How do I change the target version. I tried adding android:targetSdkVersion="integer" to the AndroidManifest and re-adding the NuGet package, but it fails again, thinking that monoandroid is 2.3. Where is this set?

Thanks

_Attempting to gather dependency information for package 'Xamarin.Android.Support.v4.23.3.0' with respect to project 'Phoneword.Droid', targeting 'MonoAndroid,Version=v2.3'
Total number of results gathered : 3
Gathering dependency information took 4 ms
Summary of time taken to gather dependencies per source :
/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.MonoDroid/Packages - 0.32 ms
/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/Xamarin.Forms.Addin/Packages - 3.66 ms
/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/FSharpBinding/Packages - 0.32 ms
Attempting to resolve dependencies for package 'Xamarin.Android.Support.v4.23.3.0' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Xamarin.Android.Support.v4.23.3.0'
Resolved actions to install package 'Xamarin.Android.Support.v4.23.3.0'
Retrieving package 'Xamarin.Android.Support.v4 23.3.0' from '__nid_1096'.
For adding package 'Xamarin.Android.Support.v4.23.3.0' to project 'Phoneword.Droid' that targets 'monoandroid23'.
Install failed. Rolling back...
Package 'Xamarin.Android.Support.v4.23.3.0' does not exist in project 'Phoneword.Droid'
Package 'Xamarin.Android.Support.v4.23.3.0' does not exist in folder '/Users/atranadmin/dev/Phoneword/packages'
Executing nuget actions took 116.7 ms
Could not install package 'Xamarin.Android.Support.v4 23.3.0'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v2.3', but the package does not contain any assembly references_

SKPaymentQueue.DefaultQueue.RestoreCompletedTransactions() - callback not being called

$
0
0

Referring to this documentation page: https://developer.xamarin.com/guides/ios/application_fundamentals/in-app_purchasing/part_5_-_transactions_and_verification/

I've got an auto-renewable subscription, and I'm calling
SKPaymentQueue.DefaultQueue.RestoreCompletedTransactions();
after previously calling
SKPaymentQueue.DefaultQueue.AddTransactionObserver(this);
in the same instance of the class (it's in the constructor).

According to the docs page, "Because the CustomPaymentObserver is registered as a transaction observer, it will receive messages when Apple’s servers respond. " I haven't been able to figure out what "CustomPaymentObserver" is, so I've been assuming that it's the ISKPaymentTransactionObserver class, which in my case is this.

My problem is that the UpdatedTransactions(SKPaymentQueue queue, SKPaymentTransaction[] transactions) method is not being called, so I'm never getting a chance to check the receipt(s) and restore the subscription if it's still valid.

Is this a bug in Xamarin, or am I doing something wrong? If I'm doing something wrong, can someone point me in the direction of what it might be?

I'm trying to do this in Debug mode, with the app deployed to my iPhone, and I'm using a non-test Apple ID, though the same happens when I try to use a test Apple ID (which is registered with TestFlight). The reason I'm not using a test ID is that I'm not deploying the app through TestFlight, as the iteration time there is WAY too long to be workable for testing.

Any pointers would be greatly appreciated.

EDIT:

When I use the TestFlight ID I set up, the callback does seem to be getting called (though it does take several minutes for this to happen), though the transactions that are returned don't have the Restored state as I was expecting. I'm doing more exploration into what I'm getting vs what I expect to get, and I'll post more information here as I learn more (in case it helps someone else who comes along in the future).

EDIT:

The first time, 4 Transactions arrived in UpdatedTransactions, and all of them had the Purchased status. The next time, 31 Transactions arrived, all of which had the Restored status. So this is closer to what I'm expecting, but the lack of consistency here is extremely troubling.

Using CarouselView in UWP crashes

$
0
0

Hello,
using CarouselView from XF 2.3.1.114 in an UWP app (constructed using XAML) just crashes without trace.
Is anybody else having the same issue?
Regards, Sascha

Xam.Plugin.Media not allowing permissions for android

$
0
0

Hi, i've been building an app for the past 8 months and never had any camera problems. I've been able to take images with the camera without any problems. I then wanted to test an apk so id archived the app and created the adhoc etc. the app installed without a problem. but the taking an image with the camera did not work

so i went back to debugging mode and went to test the app and again the camera did not work. As i had not updated the xam.plugin.media by james montemango for a while i decieded to upgrade the nuget and added the extra info as james says to use

public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}

and also set the complile and target version to api 23 marshmellow

i keep getting this error which clicking the button to open the camera

Java.Lang.SecurityException: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 cmp=com.google.android.GoogleCamera/com.android.camera.activity.CaptureActivity clip={text/uri-list U:file:///storage/emulated/0/Android/data/carraradirectoryapp.carraradirectoryapp/files/Pictures/Sample/test.jpg} (has extras) } from ProcessRecord{7f6dc9e 32591:carraradirectoryapp.carraradirectoryapp/u0a181} (pid=32591, uid=10181) with revoked permission android.permission.CAMERA

if i uninstall the app when i click the button for the camera i do get asked for permission to use the camera. once i choose allow this error appears.

upon debugging the app again i dont get asked about permissions but only get the same error.

i have included the CAMERA permission in the manifest

any ideas?

thanks

Fix orientation for one page in the app : is it possible with Xamarin.Forms?

$
0
0

Hello,

I make an app with one page who need to have a fix orientation (landscape, exactly). I try to fix the orientation for the specific page in Xamarin.Forms (XAML or C#), but it seems to be specific to each platform. I don't know if Xamarin.Forms have a cross-platform option to do it but my searches aren't conclusive.

Can anyone help me?

Thanks in advance.


[0:] Binding: 'Xxx' property not found on 'Yyy', target property: 'Xamarin.Forms.Label.Text'

$
0
0

I keep getting plenty of those error warning in the output console, but every thing shows fine.
Before anyone say it, yes this property is defined on that class and it does display and update correctly.
Yet it prints this warning in the console. Zillion of times. Swamping it with spurious noise.
Anyway to remove those spurious console output?

The root assembly conflicts with another assembly

$
0
0

Hi, after updating my Xamarin for Visual Studio it shows

Severity Code Description Project File Line Suppression State
Error The root assembly /Users/focus/Library/Caches/Xamarin/mtbs/builds/Sample.iOS/f4117d8ec82f837c5c099ce86166d4d3/bin/iPhoneSimulator/Debug/Sample.iOS.exe conflicts with another assembly (/Users/focus/Library/Caches/Xamarin/mtbs/builds/Sample.iOS/f4117d8ec82f837c5c099ce86166d4d3/bin/iPhoneSimulator/Debug/Sample.iOS.exe).

while building the ios project help me for solving this.
Thank you.

Dynamically change an Image.Source property

$
0
0

Hello,

I am trying to reset an image in my xamarin.forms project upon a button click. I have a view model with an ImageSource property which the image.Source in xaml is bound to using Image Source="{Binding ImageSource}", when I initially go to this page the image is blank which is correct, I then take a picture and set the image.Source to the path of the picture and the picture appears which is also correct. However, when I click my submit button (to submit the photo to storage), I try to reset the image.Source = null but the picture doesn't reset, it just keeps the photo that was taken. Any thoughts?

How to Compress picture size before Upload?

$
0
0

How to Compress picture size before Upload?

App runs in debug mode but not in release mode

$
0
0

AndroidRuntime Caused by: android.runtime.JavaProxyThrowable:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
Microsoft.Practices.ServiceLocation.ActivationException: Cannot register: No public constructor found in MainViewModel.

at GalaSoft.MvvmLight.Ioc.SimpleIoc.GetConstructorInfo (System.Type serviceType) [0x0012d] in :0
at GalaSoft.MvvmLight.Ioc.SimpleIoc.Register[TClass] (System.Boolean createInstanceImmediately) [0x000a5] in :0
at GalaSoft.MvvmLight.Ioc.SimpleIoc.Register[TClass] () [0x00000] in :0
at VendorEzeeAccessApp.ViewModel.ViewModelLocator..ctor () [0x0002f] in :0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in :0
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00017] in :0
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000a8] in :0
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in :0
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in :0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in :0
at System.Activator.CreateInstance (System.Type type) [0x00000] in :0
at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode) [0x00253] in :0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x000b1] in :0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00089] in :0
at Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00054] in :0
at Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydratationContext visitorContext) [0x0005a] in :0
at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml) [0x0005d] in :0
at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType) [0x0002f] in :0
at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType) [0x00000] in :0
at VendorEzeeAccessApp.App.InitializeComponent () [0x00000] in :0
at VendorEzeeAccessApp.App..ctor () [0x00006] in :0
at VendorEzeeAccessApp.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0003f

App.xaml.cs

private void navigationConfiguration()
{
nav = new NavigationServiceVn();

        if (!SimpleIoc.Default.IsRegistered<INavigationServices>())
        {


            //Registering the navigation for each page to navigation service
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.MainPage, typeof(MainPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.RegistrationPage, typeof(RegistrationPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.SearchPage, typeof(SearchPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.POItemsListPage, typeof(POItemsListPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.DetailsPage, typeof(DetailsPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.AccountInfoPage, typeof(AccountInfoPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.ForgotPasswordPage, typeof(ForgotPasswordPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.AddAdminPage, typeof(AddAdminPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.AboutPage, typeof(AboutPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.ChangePasswordPage, typeof(ChangePasswordPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.ViewAdminsPage, typeof(ViewAdminsPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.AdminVendorApprovalPage, typeof(AdminVendorApprovalPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.WebViewPage, typeof(WebViewPage));
            ((NavigationServiceVn)nav).Configure(ViewModelLocator.WebViewPageIOS, typeof(IOSWebViewPage));

            SimpleIoc.Default.Register<INavigationServices>(() => nav);
        }
        else
        {
            nav = SimpleIoc.Default.GetInstance<INavigationServices>();

        }

ViewModelLocator.cs

public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

        **SimpleIoc.Default.Register<MainViewModel>();**
        SimpleIoc.Default.Register<RegistrationViewModel>();
        SimpleIoc.Default.Register<SearchViewModel>();
        SimpleIoc.Default.Register<POItemsListViewModel>();
        SimpleIoc.Default.Register<DetailViewModel>();
        SimpleIoc.Default.Register<SettingsViewModel>();
        SimpleIoc.Default.Register<ForgotPasswordViewModel>();
        SimpleIoc.Default.Register<MenuViewModel>();
        SimpleIoc.Default.Register<AdminVendorApprovalViewModel>();
    }

   ** public const string MainPage = "MainPage";**
    public const string RegistrationPage = "RegistrationPage";
    public const string SearchPage = "SeachPage";
    public const string POItemsListPage = "POItemsListPage";
    public const string DetailsPage = "DetailsPage";
    public const string ForgotPasswordPage = "ForgotPasswordPage";
    public const string AccountInfoPage = "AccountInfoPage";
    public const string AddAdminPage = "AddAdminPage";
    public const string AboutPage = "AboutPage";
    public const string ChangePasswordPage = "ChangePasswordPage";
    public const string ViewAdminsPage = "ViewAdminsPage";
    public const string AdminVendorApprovalPage = "AdminVendorApprovalPage";
    public const string WebViewPage = "WebViewPage";
    public const string WebViewPageIOS = "WebViewPageIOS";


    public MainViewModel Main
    {
        get
        {
            return ServiceLocator.Current.GetInstance<MainViewModel>();
        }
    }

MainViewModel.cs

public class MainViewModel : ViewModelBase
{

  ..............................
    string loginRole = RoleEnumClass.Vendor.ToString();
    // RegisterParser RegParser = new RegisterParser();
    private MD5HashHelper md5helper = new MD5HashHelper();
    private INavigationServices _navigation;
    private GlobalMethods globalMethods = new GlobalMethods();
    private StoredUserDetailsModel user = new StoredUserDetailsModel();


    **public MainViewModel(INavigationServices navigation)**
    {
        _navigation = navigation;
        setPageData();

        MessagingCenter.Subscribe<EventArgs>(this, "onUsernameUnFocus", onUsernameUnFocus);

        App.getAppSettingsData();


    }

Application is working in debug mode but not in release mode. I am trying since two days please help me.

Viewing all 81910 articles
Browse latest View live


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