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

Bug(?): Samsung Device, Numeric Keyboard -> No comma, dot event not fired

$
0
0

Hey,

when i create an entry with keyboardtype numeric and run my app on samsung devices, the keyboard shows not a comma key (,). It only shows a dot key (.). But when i press the dot key, the TextChanged event is not fired.

We confirmed this behavior on a Samsung Galaxy Tab A (2016) and Samsung A5. When we install an other keyboard than the standard samsung keyboard (like SwiftKey) it works but this would be not an user-friendly solution. Numeric keyboard works correctly on devices from HTC, Sony, LG etc.

We need to enter decimal values. So we need comma or dot

Xamarin.Forms Version: 2.5.0.91635

            Xamarin.Forms.Entry entry = new Xamarin.Forms.Entry();
            entry.Keyboard = Xamarin.Forms.Keyboard.Numeric;

Is this a known bug?


ScrollView ScrollToAsync behaviour

$
0
0

Hi,

I have been having issues with using the ScrollToAsync function of a ScrollView when running on Android, not tested on iOS yet.
I'm using Xamarin.Forms version 2.5.1.444934 using .Net Standard
Testing on the Android Emulator (8.0, API26) and a Google Pixel (8.1 API27), both have the same issue.

I use NavigationPage and Navigation.PushAsync to move between pages (therefore have navigation bars on every page).

I want to create an auto populate field control, the user types in the first few letters and I look up the results in a database / static list of string and display the results below for the user to click/tap.
I have this working using a composite control (the contents of the frame marked interesting below).
The problem I have is scrolling the view to show the results.

My page has this layout hierarchy:-

ContentPage
    StackLayout
        ScrollView
            StackLayout
                Frame (some label and entry fields inside a stack layout)
                Frame (some label and entry fields inside a stack layout)
                Frame (some label and entry fields inside a stack layout)
                Frame (the interesting one that deals with scrolling)
                    StackLayout
                        Heading Label
                        StackLayout
                            Label x:Name="ScrollToLabel"
                            Entry x:Name="ScrollToEntry"
                            Grid x:Name="ScrollToGrid"
                            Entry x:Name="Hidden" Text="I should stay visible as you type"
                        /StackLayout
                    /StackLayout
                /Frame
                Frame (some label and entry fields inside a stack layout)
                Frame (some label and entry fields inside a stack layout)
            /StackLayout
        /ScrollView
        StackLayout
            Button Text = Done
        /StackLayout
    /StackLayout
/ContentPage

When the user clicks/taps in to ScrollToEntry, the keyboard opens and pans the control to above the keyboard (ok so far).
When the user starts typing in ScrollToEntry, the code populates ScrollToGrid with up to 5 results.
At this point I want to make sure that the grid results are visible for the user to tap on.
I have tried 2 different options, ScrollToAsync(ScrollToLabel, Start) and ScrollToAsync(Hidden, MakeVisible).

Neither work as I would like 100% of the time.

ScrollToAsync(ScrollToLabel, Start)

If the ScrollToEntry is at the bottom of the screen, the navigation bar is hidden and the view pans up too far.
The ScrollToLabel is now off the top of the screen.
When the second letter is clicked/tapped, the Navigation bar is restored and the scroll scrolls correctly, ScrollToLabel at the top of the screen.
If the ScrollToEntry is near the top of the screen, the navigation bar is not hidden and it scrolls correctly.

ScrollToAsync(Hidden, MakeVisible)
This is my preferred option because it would only scroll as far as needed to display all the results (not all the way to the top).
This works even worse than the first one.
In most cases, it does not scroll at all, I assume it thinks it already visible but is actually behind the keyboard?
If it does scroll, the label Hidden is still not displayed (I tested with both a HeightRequest="0" version and a visible version, both the same result).

I tried using the below code to change the adjust to resize.
Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);

2 issues,
1. Because it resizes, the Done button now is above the keyboard, taking up space.
2. When clicking the hardware back button (not the done or navigation back button) the previous view now has a white space where the keyboard was.
If using the done or navigation back, the screen initially appears with the white space but then refreshes to full screen.

I have created a sample app that highlights the issues (by default using pan, not resize) attached.
Its the most simple version of the layout I'm using.

Am I doing something wrong or is this just how it works?
If its how it works, this must be a bug?
If I'm doing it wrong, can someone tell me what or suggest a different way of doing it?

Thanks

Unhandled Exception: System.InvalidOperationException: bindable not an instance of AssociatedType o

$
0
0

Hi,
i got this error

Unhandled Exception:

System.InvalidOperationException: bindable not an instance of AssociatedType occurred

I dont Know how to solve this. Please Let me know if you have solution for this error.

Unable to authentificate on iOS in Xamarin forms project

$
0
0

I made a PCL in which I must identify myself so I have a login page and use login page render that are plateform specific using Xamarin Forms.

On android I am able to authentificate myself with this call : Context.StartActivity(oAuth2Authenticator.GetUI(Context)); in the android renderer

The problem is on iOS when I call this : PresentViewController(oAuth2Authenticator.GetUI(), true, null);

Only a white screen appears.

Before the renderer is called navigation.PushModalAsync(new LoginPage(…)) is called.

Any ideas?

Thanks

How can I improve the button on a Card (listview item) so you can tap on it easy

$
0
0

Hi Guys,

I have a listview with Cards as items. On each Card on the right bottom corner, there is a calendar icon as a button so you can tap on it and set the the date of the availability. But it's difficult to tap on the calendar icon, instead it taps on the Card. How can I improve this? I already tried making the button bigger or the paddings but no result. Can somebody help me out?

Merci!

Custom Tabs MasterDetailPage

$
0
0

I have a simple custom tabs set up.
When starting my app I have a MasterDetailPage root view.
This is used for a side menu and the detail page is my TabsPageView that inits my custom tabs.
In the root view all I do is
new NavigationPage(new TabsPageView())

In IOS I am not having any problems the detail page renders with the tabs as expected.
On the Android side nothing renders and there are no errors.
I can see with BP that every thing is getting called and set up as it should but nothing is on the view.
If I by pass the NavigationPage and just new up the TabsPageView .. The tabs show up in android but now I have lost my MasterDetailPage.

Thanks,

Xam.Plugin.Media Take Picture on iOS

$
0
0

Hi,
I'm using the Xam.Plugin.Media in my Forms app to take pictures.
I take the Image stream (GetStream) and convert to a byte[] and store in my DB.
I then use that as the image source.
On Android and UWP, its working fine.
On iOS, if the picture is taken in portrait mode, the image once, selected is always rotated 90 deg.
I will later, upload this to a server and that image could be used on a different device.
For this, I also tried the GetStreamWithImageRotatedForExternalStorage but in this case, I cant see the image at all.
There are bytes in the stream (I DisplayAlert the length) but the image does not display.

Any idea what I might be doing wrong?

My code:-

        private async Task TakePicture(WineDetails details)
        {
            await CrossMedia.Current.Initialize();

            if (CrossMedia.Current.IsCameraAvailable && CrossMedia.Current.IsTakePhotoSupported)
            {
                var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                {
                    AllowCropping = true,
                    PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium,
                    SaveToAlbum = false,
                    RotateImage = true                    
                });

                if (file == null)
                    return;

                using (var ms = new MemoryStream())
                {
                    var stream = file.GetStreamWithImageRotatedForExternalStorage();

                    stream.CopyTo(ms);
                    details.LabelImage = ms.ToArray();

                    details.NotifyChange("ImageSource");
                }
            }
        }

The image is updated in the page via the NotifyChange and looks like this:-
ImageSource.FromStream(() => new MemoryStream(this.LabelImage))

This works fine in all cases on Android and UWP, works on iOS using GetStream (except the image is incorrectly rotated) but does not work using GetStreamWithImageRotatedForExternalStorage on iOS.

Anyone else using this plugin?

Thanks

How to make a layout's height proportional to its width? For example, a 3:4 ratio AbsoluteLayout?

$
0
0

How do I make a layout's height proportional to its width? I'd like to have an AbsoluteLayout that fills the available width and has its height set as a percentage of its width.


ADO.NET for SQLite and Xamarin Forms

$
0
0

I need a robust API to access my SQLite database from Xamarin forms. The ORM approach is too rigid, I want and ADO like API to access the DB.
I have found the followng nuget packages: Microsoft.Data.SQLite, SimpleAdo.Sqlite

Does Microsoft.Data.SQLite work with a Xamarin Forms application?

Data binding Xamarin Forms

$
0
0

Hi, I have a question about Data Binding.
I have a View, with inside a Listview who have an ObservableCollection as ItemSource.
I have a ViewCell, which is the Template of the Listview, and I bind some data in it.
Everything works great.
In addiction, now, I want, when a property is changed in the ViewCell, to fire an event who stay inside the Controller of my View.
I try the MessaggingCenter and it works but I don't like it very much.

The code:

public class StatusOfClassroomModel :  INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    private void OnPropertyChanged(string nameOfProperty)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameOfProperty));
    }

    String _prefered;
    public String prefered
    {
        get
        {
            return _prefered;
        }
        set
        {
            _prefered = value;
            OnPropertyChanged("prefered");
        }
    }
}

public class BusyClassroomsView : ContentView
{
    public BusyClassroomsView(MainControllerStatusClassrooms mainController)
    {
        listView = new ListView(ListViewCachingStrategy.RecycleElement)
        {
            RowHeight = -1,
            ItemTemplate = new DataTemplate(typeof(TemplateListofStatusClassroom)),
            IsPullToRefreshEnabled = true,
            IsGroupingEnabled = false,
            HasUnevenRows = true
        };
    }
}

public class TemplateListofStatusClassroom : ExtendedViewCell
{
    public TemplateListofStatusClassroom()
    {
        Image preferedClassroomImage = new Image();
        preferedClassroomImage.SetBinding(Image.SourceProperty, "prefered");

        TapGestureRecognizer imageTap = new TapGestureRecognizer();
        imageTap.Tapped += ImageTap_Tapped;
        statusClassroom.GestureRecognizers.Add(imageTap);
    }

    void ImageTap_Tapped(object sender, EventArgs e)
    {
        HERE I WANT TO FIRE A METHOD OF mainController PASSED ON COSTRUCTOR OF BusyClassroomsView.
    }
}

Thank's to all.

Xamarin.Forms.Maps set up problem

$
0
0

Hi, I'm having a problem adding a map to my App. I am following the instructions from the page - https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/map. Having added the Maps package via NuGet, I get 92 errors in my project, in multiple files. I won't list them all but here's the first one and the rest are of a similar flavour.

Severity Code Description Project File Line Suppression State
Error error: package com.google.android.gms.common.api.GoogleApiClient does not exist
com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks MobileAppTest.Android C:\Documents\work\DOTNET\MobileAppTest\MobileAppTest\MobileAppTest.Android\obj\Debug\android\src\md513074be467e0034b6ca192c1689af813\GoogleApiClientConnectionCallbacksImpl.java 8

Each error indicates some package is missing. I have checked Android SDK Manager and everything is up-to-date.

In an attempt to work out what is going wrong, I created a new App straight 'out of the box' in VS 2017 and simply added the Maps package and the errors appeared. So I'm guessing it's something in my Android setup, but have no clue as to what?

Cheers
John

Taking a picture exception (getParameters failed) using Xamarin Forms

$
0
0

I am receiving the following exception when I attempt to snap a pick via my app on Android (Samsung SM_G965U1 (Android 8.0 - API 26)):

Java.Lang.RuntimeException: getParameters failed (empty parameters)

This error occurs immediately following the clicking of the OK to accept the image, but before control is returned to my code. I am calling Plugin.Media.CrossMedia.Current.TakePhotoAsync(). The call actually crashes the app. Works correctly on iOS.

        var _Pic = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions()
        {
            PhotoSize = PhotoSize.Medium
        });

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.companyname.myapp" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="26" />
    <application android:label="ScanStar.Android">
        <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.companyname.myapp.fileprovider" android:exported="false" android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
        </provider>
    </application>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

file_paths.xml:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <external-files-path name="my_images" path="Pictures" />
  <external-files-path name="my_movies" path="Movies" />
</paths>

Thanks,
Dave

Why UWP Images in Root Rather Than Assets?

$
0
0

To use the same local image across iOS, Android and Windows in Xamarin Forms -- AND use the same file name -- you need to follow Xamarin's conventions for where to locate the file. For iOS, the image file goes into the Resources folder. For Android, the image file goes into the Resources/drawable* folder(s). But for UWP, the image goes into the root directory. Why not the Assets directory? This is the more traditional location. What am I missing?

How to read controls values if inside ResourceDictionary?

$
0
0

Hi,

I have a calendar inside ResourceDictionary in the below code... How can I read the value of that calendar? I tried it the normal way but getting:

The name 'CalendarPrayerTimes' does not exist in the current context

Here is my code:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Jafaria.PrayerTimes"
    xmlns:SyncfusionCalendar="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms"
    xmlns:SyncfusionMaps="clr-namespace:Syncfusion.SfMaps.XForms;assembly=Syncfusion.SfMaps.XForms"
    xmlns:XamarinMaps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps"
    Title="مواقيت الصلاة">
    <ContentPage.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="PrayerTimeTemplate">
                <ContentView BackgroundColor="White" x:Name="PrayerTimeContentView">
                    <SyncfusionCalendar:SfCalendar x:Name="CalendarPrayerTimes" FlowDirection="RightToLeft" ShowHeader="true" OnHeaderLoaded="Handle_OnHeaderLoaded" MonthChanged="Handle_MonthChanged" Margin="20,20,20,20" SelectionChanged="Handle_SelectionChanged" />
                </ContentView>
            </DataTemplate>
        </ResourceDictionary>
    </ContentPage.Resources>
    <ContentPage.Content>
    <Grid FlowDirection="RightToLeft" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Padding="25">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    .....................................
    .....................................
    .....................................
    .....................................
    .....................................

Thanks,
Jassim

Is anyone actually using the geofence plugin in production?

$
0
0

I have created an app that uses the geofence plugin (https://github.com/domaven/xamarin-plugins/tree/master/Geofence) to notify users when they enter/exit certain locaitons.

It works to some extent, but there are a few problems:
-When monitoring location exit, iOS users experience numerous false exit notifications, especially when moving around inside the location perimeters. Also if moving outside the location, when phone wakes up after being inactive, one can get 3-4 notifications about exiting the location, even if the user is far away
-All proper exit notifications (not the fake ones) are displayed twice on iOS
-On Android, some users don't get notifications at all, especially if the app is in background or closed

I am thinking about moving to the acr geofencing plugin (https://github.com/aritchie/geofences/tree/master/), but it is a bit of work. So I am wondering if:

1.Does anyone else have experience with either of these plugins in production?
2.Anyone else have experience with same problems that I am facing?

It's weird that nobody else seems to have problems. I was a newbie to Xamarin when writing the app, I am thinking of creating a small sample. Maybe I have made mistakes, although I have been going through my code several times without finding any. Maybe nobody is actually using the geofence plugin for other than playing around....

Appreciate any insights on this.


Native linking failed, undefined Objective-C class error

$
0
0

Hi All,

I have a Xamarin Forms iOS project which is failing to build with this error

Native linking failed, undefined Objective-C class: TCDeviceDelegate. The symbol '_OBJC_CLASS_$_TCDeviceDelegate' could not be found in any of the libraries or frameworks linked with your application.

It starts the build and fails with this error after about 10 minutes (older model MacBook so its slow).

This TCDeviceDelegate class is part of the nuget.org package - Twilio.Client.Component v1.0.1
Which results in the following DLL being included in the iOS project - TwilioClient.iOS-Unified.dll

My PC environment is:

  • Visual Studio Community 2017 v15.7.4
  • Microsoft .NET Framework Version 4.7.02556
  • Xamarin 4.10.10.2 (35a01d8dc)
  • Xamarin Designer 4.12.1 (f3257e429)
  • Xamarin.iOS and Xamarin.Mac SDK 11.12.0.4 (64fece5)

On my MacBook it is paired fine, also running the latest Visual Studio:

  • Visual Studio Community 2017 for Mac (v.7.5.3)
  • Xamarin.iOS v.11.12.04

What I have tried:

  • Removing and adding the Twilio NuGet package
  • Rebooting PC and Mac
  • Removing bin/obj folders and rebuild
  • Clean and rebuild every time
  • Removing the packages folder Twilio DLLs
  • Tried setting the linker behaviour to both "Link Framework SDKs Only" and also "Link All"

All of the above had no effect, the build fails with the same error every time

Any help would be greatly appreciated,

Harvey Green****

Xamarin Forms location services work on iOSimulator but not on Testflight build

$
0
0

Repost from stackoverflow, if its ok...

I am working on a Xamarin Forms app that asks the user for Location services permission using PermissionsPlugin by James Montemagno. I use Visual Studio 2017 in Windows and a Virtual Machine as my MAC build host (macOS High Sierra 10.13.4).

My problem is that the app works as intended when deployed to the iOSimulator. It prompts the user to allow or deny the use of location services. In the simulator, the app is even listed under Settings>Privacy>Location Services. But after delivering the built IPA file to Apple and testing it via Testflight, the app does not prompt anything and just loads indefinitely. The app is also not listed in Settings>Privacy>Location Services.

Here is the code from the app for requesting permission:

async Task<bool> AskPermission()
{
    var hasPermission = false;

    try
    {
        var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location);

        if (status != PermissionStatus.Granted)
        {

            if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Location))
            {
                await App.Current.MainPage.DisplayAlert("Need location", "Allow app to access location?", "OK", "Cancel");
            }

            var results = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location);

            if (results.ContainsKey(Permission.Location))
            {
                status = results[Permission.Location];
            }
        }

        if (status == PermissionStatus.Granted)
        {
            hasPermission = true;
        }
        else if (status != PermissionStatus.Unknown)
        {
            await App.Current.MainPage.DisplayAlert("Location Denied", "Can not continue, try again.", "OK");
        }
    }
    catch (Exception ex)
    {

    }

    return hasPermission;
}

This is one of the methods that is called on click of a button. An activity indicator then appears since it is bound to a boolean that is toggled when the all methods are started/done.

This is pretty much the sample code from James Montemagno's plugin. I suspect the app gets stucked on await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location).

I also added the necessary additions to Info.plist in the iOS project of the App:

            <key>NSLocationWhenInUseUsageDescription</key>
            <string>prompt message</string>
            <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
            <string>prompt message</string>

I also tested variations where I used NSLocationAlwaysUsageDescription instead of NSLocationWhenInUseUsageDescription but got similar results...

I tested this in iOSimulator (iPhone 5, 6, 7, all in 11.3, all worked) and tested in Testflight using an iPhone 7 and an iPad, both in 11.3 as well; unfortunately, both cases didn't prompt permission request dialog.

For reference, this works as intended in Android both in debugging and testing from Play store.

Unable to Deploy Xamarin Forms App (Both Debug & Release Mode) in VS 2017 15.6.4 & VS 2015 Update 3

$
0
0

I was able to deploy the app successfully, but all of a sudden it stopped deploying. Build is successful but failing when trying to deploy.
I am using Visual Studio Prof 2017 15.6.4 version.
Below are the installed Xamarin Versions.
Xamarin 4.9.0.752,
Xamarin.Android Sdk 8.2.0.16

My Xamarin Forms Project is Compiling with Android 7.0 and Targeting Android 7.0 Version.

I have tried every possible attempts to solve, several restarts, clean cache, clean bin and obj folders etc., but no success.

I have updated Xamarin Tools for VS 2015 yesterday, but even after that I didn't face any issue in VS 2017. I have deployed the app today several times but it suddenly stops deploying. Earlier I was facing this issue when I compile and target with Andorid 8.0/8.1. But today Android 7.0 also not working.
I didn't do any updates in VS 2017.

Below is the Error.

8>Starting deploy Zebra Technologies TC56 ...
8>Deploying Zebra Technologies TC56 ...
8>Build started.
8>Project "QNPL.Mobile.Droid.csproj" (Install target(s)):
8>C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.0-rc1\zipalign.exe 4 "D:\WorkSpace\Application\QonnectPlus\QNPL.DEV46\Mobile\QNPL.Mobile\QNPL.Mobile\QNPL.Mobile.Droid\obj\Release\android\bin\com.qonnectplus.android.apk" "bin\Release\com.qonnectplus.android-Signed.apk"
8>C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.0-rc1\apksigner.BAT sign --ks "D:\Users\55421\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 16 --max-sdk-version 24 bin\Release\com.qonnectplus.android-Signed.apk
8>"apksigner.BAT" exited with code 1.
8>Done building project "QNPL.Mobile.Droid.csproj" -- FAILED.
8>Build FAILED.
8>Build started.
8>Project "QNPL.Mobile.Droid.csproj" (Install target(s)):
8>C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.0-rc1\zipalign.exe 4 "D:\WorkSpace\Application\QonnectPlus\QNPL.DEV46\Mobile\QNPL.Mobile\QNPL.Mobile\QNPL.Mobile.Droid\obj\Release\android\bin\com.qonnectplus.android.apk" "bin\Release\com.qonnectplus.android-Signed.apk"
8>C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.0-rc1\apksigner.BAT sign --ks "D:\Users\55421\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 16 --max-sdk-version 24 bin\Release\com.qonnectplus.android-Signed.apk
8>"apksigner.BAT" exited with code 1.
8>Done building project "QNPL.Mobile.Droid.csproj" -- FAILED.
8>Build FAILED.

I am getting the below error when I try to deploy the same project in Visual Studio 2015.

1>The package was not properly signed (NO_CERTIFICATES).
1> at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A_work\16\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 325
1> at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass94_0.b__0(Task1 t) in E:\A\_work\16\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 746 1> at System.Threading.Tasks.ContinuationTaskFromResultTask1.InnerInvoke()
1> at System.Threading.Tasks.Task.Execute()

Unable to access app data files

$
0
0

Hello All
This is a Dependency-Service class to save a PDF file. after updating my project target to oreo 8.1 (.Net Standard 2) I can not save the PDF file in an External-Storage-Directory. now I not able share the PDF to any PDF reader. (unable to access app data the files)

    void ISave.Save(string filename, MemoryStream stream)
    {


        var dirPath =  Android.App.Application.Context.FilesDir + "/XXX";
        var filepath = dirPath + "/Output.pdf";
        Directory.CreateDirectory(dirPath);
        Java.IO.File newfile = new Java.IO.File(dirPath, "Output.pdf");
        if (newfile.Exists()) newfile.Delete();
        using (FileOutputStream outfile = new FileOutputStream(newfile))
        {
            outfile.Write(stream.ToArray());
            outfile.Flush();
            outfile.Close();
        }
        if (newfile.Exists())
        {
            Android.Net.Uri path = Android.Net.Uri.FromFile(newfile);
            string extension = Android.Webkit.MimeTypeMap.GetFileExtensionFromUrl(Android.Net.Uri.FromFile(newfile).ToString());
            string mimeType = Android.Webkit.MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
            Intent intent = new Intent(Intent.ActionView);
            intent.AddFlags(ActivityFlags.GrantReadUriPermission);
            intent.SetDataAndType(path, mimeType);
            var activity = (Activity)GetContext();
            activity.StartActivity(Intent.CreateChooser(intent, "Choose App"));
        }
    }
}

}

How to manage two scroll view inside a content page?

$
0
0

I have a content page with user registration form,when user register for and save it then user details will show on a table view(created with grid view)
But while content page scrolling then table view data is not scrolling.

<ContentPage.Content>
        <ScrollView>
            <StackLayout x:Name="MainStackLT" Spacing="0" BackgroundColor="#f7f7f4">
                <ActivityIndicator Color="#6786C1" HorizontalOptions="Center" VerticalOptions="Center" IsRunning="False" IsVisible="False" x:Name="loadLt"/>
                <Frame BackgroundColor="White">
                    <Label x:Name="vWoid" HorizontalOptions="CenterAndExpand" FontAttributes="Bold" Style="{StaticResource LabelStyle}"/>
                </Frame>
                <StackLayout Padding="10" Spacing="0">
                    <Entry x:Name="hdnWoId" IsVisible="False"/>
                    <Label Text="Employee :" Style="{StaticResource LabelStyle}"/>
                    <Picker x:Name="LTEmployee" SelectedIndexChanged="ChangeEmployee" ItemDisplayBinding="{Binding EmployeeName}" Title="Select" Style="{StaticResource PickerStyle}">

                    </Picker>

                    <Label Text="Hour Worked :" Style="{StaticResource LabelStyle}" />
                    <Entry x:Name="HourWorked" Keyboard="Numeric" Text="" Placeholder="Hours" Style="{StaticResource EntryStyle}">
                        <Entry.Behaviors>
                            <behaviors:EntryLengthValidatorBehavior MaxLength="5" />
                        </Entry.Behaviors>
                    </Entry>

                    <Label Text="Work Date :" Style="{StaticResource LabelStyle}"/>
                    <DatePicker x:Name="WorkDate" TextColor="Gray"/>

                    <Label Text="Trade :" TextColor="Black" Style="{StaticResource LabelStyle}"/>
                    <Picker x:Name="LTTrade" Title="Select" ItemDisplayBinding="{Binding tradecode}">

                    </Picker>
                    <Label x:Name="hdnTrid" IsVisible="False" Text="" />
                    <Label x:Name="updateMode" IsVisible="False" Text="" />
                    <Label x:Name="updateModeTrade" IsVisible="False" Text="" />
                    <Label x:Name="updateModeLabourType" IsVisible="False" Text="" />


                    <Label Text="Labor Type :" Style="{StaticResource LabelStyle}" />
                    <Picker x:Name="TTLabourType" Title="Select" ItemDisplayBinding="{Binding Description}"  SelectedItem="{Binding Description}" Style="{StaticResource PickerStyle}">

                    </Picker>

                    <Label Text="Paid From :" Style="{StaticResource LabelStyle}" />
                    <Entry x:Name="PaidFrom" Text="1" Placeholder="Hours" Style="{StaticResource EntryStyle}">
                        <Entry.Behaviors>
                            <behaviors:EntryLengthValidatorBehavior MaxLength="50" />
                        </Entry.Behaviors>
                    </Entry>

                    <Label Text="Charged To :" Style="{StaticResource LabelStyle}" />
                    <Entry x:Name="ChargedTo" Text="1" Placeholder="Hours" Style="{StaticResource EntryStyle}">
                        <Entry.Behaviors>
                            <behaviors:EntryLengthValidatorBehavior MaxLength="50" />
                        </Entry.Behaviors>
                    </Entry>
                    <BoxView Color="Gray" HeightRequest="5" />
                    <!--table view labor transaction-->
                    <ContentView>
                        <StackLayout x:Name="LTtable" BackgroundColor="#DFDEDE" Padding="4" Spacing="0">
            <ScrollView>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto" />
                                </Grid.RowDefinitions>

                                <Label Text="Name" Grid.Row="0" Grid.Column="0" HorizontalTextAlignment="Center" TextColor="Black" VerticalOptions="Center"/>
                                <Label Text="Hours" Grid.Row="0" Grid.Column="1" HorizontalTextAlignment="Center" TextColor="Black" VerticalOptions="Center"/>
                                <Label Text="Date" Grid.Row="0" Grid.Column="2" HorizontalTextAlignment="Center" TextColor="Black" VerticalOptions="Center"/>
                                <Label Text="Trade" Grid.Row="0" Grid.Column="3" HorizontalTextAlignment="Center" TextColor="Black" VerticalOptions="Center"/>
                                <Label Text="Labor Type" Grid.Row="0" Grid.Column="4" HorizontalTextAlignment="Center" TextColor="Black" VerticalOptions="Center"/>
                                <StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand" Grid.Row="1" Grid.ColumnSpan="5">
                                    <ListView x:Name="LabortableDataView" ItemSelected="ItemSelected">
                                        <ListView.ItemTemplate>
                                            <DataTemplate>
                                                <ViewCell>
                                                    <Grid>
                                                        <Grid.RowDefinitions>
                                                            <RowDefinition Height="50" />
                                                        </Grid.RowDefinitions>
                                                        <Label Text="{Binding EmployeeName}" Grid.Row="0" Grid.Column="0" Style="{StaticResource LabelStyleForTable}"/>
                                                        <Label Text="{Binding HoursWorked}" Grid.Row="0" Grid.Column="1" Style="{StaticResource LabelStyleForTable}"/>
                                                        <Label Text="{Binding WorkDate}" Grid.Row="0" Grid.Column="2" Style="{StaticResource LabelStyleForTable}"/>
                                                        <Label Text="{Binding Trade}" Grid.Row="0" Grid.Column="3" Style="{StaticResource LabelStyleForTable}"/>
                                                        <Label Text="{Binding LabourType}" Grid.Row="0" Grid.Column="4" Style="{StaticResource LabelStyleForTable}"/>
                                                    </Grid>
                                                </ViewCell>
                                            </DataTemplate>
                                        </ListView.ItemTemplate>
                                    </ListView>
                                </StackLayout>
                            </Grid>
            </ScrollView>
                        </StackLayout>
                    </ContentView>
                </StackLayout>

            </StackLayout>
        </ScrollView>
    </ContentPage.Content>

How to solve this?

Viewing all 91519 articles
Browse latest View live


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