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

Where to store an audio file after recording cross platform?

$
0
0

I have found ways to record sound in Xamarin.Forms either doing it using Dependency Injection or a Plug in but I am not sure how I could store the obtained file, and where I should store for all platforms. Can I get some guidance please?

The Audio file is used so that the user can set their own recording as a custom alarm for an event. Ideally it would be available even after app updates, but I am just looking for the best way to do this.

Here is the code I am using to record sound, in this example using the AudioRecorder Plugin found here:
https://github.com/NateRickard/Plugin.AudioRecorder/blob/master/Samples/Forms/AudioRecord.Forms/MainPage.xaml.cs

public partial class MainPage : ContentPage
    {
        private AudioRecorderService recorder;
        private AudioPlayer player;

        public MainPage()
        {
            InitializeComponent();

            // initialize recorder
            recorder = new AudioRecorderService
            {
                StopRecordingOnSilence = true, //will stop recording after 2 seconds (default)
                StopRecordingAfterTimeout = true,  //stop recording after a max timeout (defined below)
                TotalAudioTimeout = TimeSpan.FromSeconds(5) //audio will stop recording after 5 seconds
            };

            //initializer player part of same plugin
            player = new AudioPlayer();

        }

        private async void buttonRecord_Clicked(object sender, EventArgs e)
        {
            await RecordAudio();
        }

        private async Task RecordAudio()
        {
            try
            {
                if (!recorder.IsRecording)
                {
                    var recordTask = await recorder.StartRecording();

                    var audioFile = await recordTask;

                    if (audioFile != null)
                    {
                        // store the audioFile
                    }
                }
                else
                {
                    await recorder.StopRecording();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }

Picker Xamarin forms get elemnt index

$
0
0

I have this list that contain LocationID and location name , I can show in the picker the locationName , but how I can get the locationId of the selected locationName ?

   var locationpart = new List<Location>
                    {
                        new Location
                        {

                            LocationID= "1",
                               LocationName= "Z test"
                        },

                            new Location
                        {

                            LocationID= "2",
                               LocationName= "SFAX"
                        }

                    };
                PickLocations.ItemsSource = locationpart;


            <Picker Title="Select a Location"
                                    BackgroundColor="White"
                                    TextColor="Black"
                                    HorizontalOptions="FillAndExpand" 
                                    VerticalOptions="Center"
                                    Grid.Row="0" 
                                    Grid.Column="1" x:Name="PickLocations"

                                    ItemDisplayBinding="{Binding LocationName}" 
                                    SelectedIndexChanged="PickLocations_SelectedIndexChanged"/>



                                      private void PickLocations_SelectedIndexChanged(object sender, EventArgs e)
                                            {
                                    //how can i get the locationID ?
                                    }

How do you do a web api get in xamarin forms.... I see only post examples... is it even possible???

$
0
0

Hi all is there a way to do a web api get in this xamarin forms or is it not supported... the examples on the microsoft site are horrible...
and dont give much details.

my web api is working and my post from the xamerin forms is work... but it is impossible to get the data from the web api to display as a list on the xamarin form...

Pass enum value in command parameter

$
0
0

Hi,

How to pass enum value as command parameter and what would be command type in viewmodel. I am using Prism and passing enum value like below

CommandParameter="{x:Static localenum:GradeTypes.PreventiveStyle}"

my viewmodel property is

public DelegateCommand<GradeTypes> TapSubGradeCommand { get; set; }

after running my application crashes. always we need send command parameter as string or generic values in Prism.

Spam is getting out of hand

$
0
0

Title basically says everything. The spam from whoever these guys are is getting seriously out of hand. It is nearly impossible to use the forum with the amount of "shitposting" going on. Can't the admins do anything against that. It's really grinding my gears....

Xamarin Forms and DropBox - get " Bad HTTP Content-Type" error when downloading file

$
0
0

Hi all,

I was sure I'd posted this question to the forums already but my profile does not show any questions having been posted so I'm trying again.

Ok, so I have an existing Winsdows10 UWP app called "PassPort" which uses v2 of the standard DropBox API to upload and download data files without issue. Now I want to get this app working on my Android phone (Nokia 8 running Android 8.1) so I created a XF project, copied my download/upload code over to the main project and added Xamarin.Dropbox API from NuGet. I can create a valid Dropbox session, get basic stuff like user details etc but when I try to download a file I get this error:

Error in call to API function "files/download": Bad HTTP "Content-Type" header: "application/x-www-form-urlencoded". Expecting one of "text/plain", "text/plain; charset=utf-8", "application/octet-stream", "application/octet-stream; charset=utf-8".

Now I cannot see anywhere in the Xamarin.Dropbox API that allows me to specify a content-type for the header so I am really stuck!

Here is the code I'm using to download the file - this works perfectly every time with the standard Dropbox API.

    public static async Task<string> DownloadFile(string filePath, string fileName)
    {
        string output = null;

        try
        {
            if (dbxClient == null)
                dbxClient = new DropboxClient(accessToken);

            if (dbxClient != null)
            {
                var downloadResponse = await dbxClient.Files.DownloadAsync(filePath + fileName);
                var output = await downloadResponse.GetContentAsStringAsync();
            }
            else
                throw new Exception("DownloadFile: DropBox client not authenticated");

        }
        catch (Exception ex)
        {
            Exception = ex;
            output = ex.Message;
        }

        return output;
    }

Now I'll admit this is my first Xamarin Forms project so perhaps I'm doing something wrong but the app runs perfectly Ok on the "Android_accelerated_c86_Oreo" 8.1 emulator until I try to run the above code...so does anyone know how I can resolve this?

Please don't tell me to post over on the official Dropbox forums - I did that and they replied that as it's a Xamarin specific version of the Dropbox API, I would need to ask over here on the Xamarin forums.

How to use DropBox component in Xamarin.Forms App?

$
0
0

Hi,

I'm a big fan of Xamarin.Forms and wanted to extend a Forms project I'm currently working on with a DropBox component. But as soon as I add the component from the component store the project does not compile anymore:

error MT5212: Native linking failed, duplicate symbol: '_main'.
error MT5213: Duplicate symbol in: /Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/Dropbox.a(test_harness_main.o) (Location related to previous error)
error MT5213: Duplicate symbol in: /Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.o (Location related to previous error)
error MT5309: Native linking error: 1 duplicate symbol for architecture i386

Any Ideas?

Compiling to native code
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache" --nomanifest --nosign -sim "/Users/michaelhenke/Projects/BT/iOS/bin/iPhoneSimulator/Debug/BTiOS.app" -r "/Users/michaelhenke/Projects/BT/BT/bin/Debug/BT.dll" -r "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.dll" -r "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.Xml.dll" -r "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/System.Core.dll" -r "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/monotouch.dll" -r "/Users/michaelhenke/Projects/BT/Components/dropboxsync-3.1.0/lib/ios/DropBoxSync.iOS.dll" -r "/Users/michaelhenke/Projects/BT/iOS/../packages/Xamarin.Forms.1.2.3.6257/lib/MonoTouch10/Xamarin.Forms.Platform.iOS.dll" -r "/Users/michaelhenke/Projects/BT/iOS/../packages/Xamarin.Forms.1.2.3.6257/lib/MonoTouch10/Xamarin.Forms.Core.dll" -r "/Users/michaelhenke/Projects/BT/iOS/../packages/Xamarin.Forms.1.2.3.6257/lib/MonoTouch10/Xamarin.Forms.Xaml.dll" -debug -nolink -sdk "8.1" -targetver "7.0" --abi=i386 "/Users/michaelhenke/Projects/BT/iOS/bin/iPhoneSimulator/Debug/BTiOS.exe"
Xamarin.iOS 8.4.0 Business Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk
warning MT0049: PushKit.framework is supported only if deployment target is 8.0 or later. PushKit features might not work correctly.
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -lc++ -lz -Wl,-pie  -arch i386 -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=7.0 /Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.o -force_load /Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/Dropbox.a -o /Users/michaelhenke/Projects/BT/iOS/bin/iPhoneSimulator/Debug/BTiOS.app/BTiOS -framework AVFoundation -framework Accelerate -framework AudioToolbox -framework QuartzCore -framework CoreBluetooth -framework CoreData -framework CoreGraphics -framework CoreImage -framework CoreLocation -framework CoreText -framework Foundation -framework UIKit -framework GameKit -framework GLKit -framework ImageIO -framework JavaScriptCore -framework MobileCoreServices -framework SpriteKit -framework Security -framework StoreKit -framework SystemConfiguration -framework AddressBook -framework CoreMedia -framework CoreMIDI -framework CoreVideo -framework AssetsLibrary -framework Accounts -framework CoreTelephony -framework EventKit -framework EventKitUI -framework ExternalAccessory -framework CoreMotion -framework iAd -framework MapKit -framework MediaPlayer -framework MessageUI -framework NewsstandKit -framework OpenGLES -framework Social -framework Twitter -framework PassKit -framework MultipeerConnectivity -framework AddressBookUI -framework GameController -framework MediaAccessibility -framework SafariServices -framework AdSupport -framework QuickLook -framework CFNetwork -weak_framework AVKit -weak_framework CloudKit -weak_framework SceneKit -weak_framework WebKit -weak_framework LocalAuthentication -weak_framework NetworkExtension -weak_framework HealthKit -weak_framework HomeKit -weak_framework NotificationCenter -weak_framework Photos -weak_framework PhotosUI -lz -liconv -u _mono_pmip -u _xamarin_init_nsthread -u _monotouch_release_managed_ref -u _monotouch_create_managed_ref -u _xamarin_get_block_descriptor -u _monotouch_start_wwan -u _xamarin_IntPtr_objc_msgSend_IntPtr -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr -u _xamarin_IntPtr_objc_msgSend_IntPtr_IntPtr_int -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr_IntPtr_int -u _xamarin_IntPtr_objc_msgSend_IntPtr_int_int_int_int -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr_int_int_int_int -u _xamarin_IntPtr_objc_msgSend_IntPtr_int_int_int -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr_int_int_int -u _monotouch_timezone_get_names -u _monotouch_timezone_get_data -u _monotouch_get_locale_country_code -u _monotouch_log -u _CreateZStream -u _CloseZStream -u _Flush -u _ReadZStream -u _WriteZStream -u _DBPrincipalPublic -u _DBPrincipalTeam -u _kDBSDKVersion -u _DBDatastoreBaseChangeSize -u _DBDatastoreBaseSize -u _DBDatastoreBaseUnsyncedChangesSize -u _DBDatastoreRecordCountLimit -u _DBDatastoreSizeLimit -u _DBDatastoreUnsyncedChangesSizeLimit -u _DBFieldBaseSize -u _DBListItemBaseSize -u _DBRecordBaseSize -u _DBRecordSizeLimit /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.16/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonoboehm-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.16/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch-debug.a /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.16/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libapp.a -dead_strip
duplicate symbol _main in:
    /Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/Dropbox.a(test_harness_main.o)
    /Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error MT5212: Native linking failed, duplicate symbol: '_main'.
error MT5213: Duplicate symbol in: /Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/Dropbox.a(test_harness_main.o) (Location related to previous error)
error MT5213: Duplicate symbol in: /Users/michaelhenke/Projects/BT/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.o (Location related to previous error)
error MT5309: Native linking error: 1 duplicate symbol for architecture i386
error MT5202: Native linking failed. Please review the build log.

How to update Mono.Android version to resolve dependancies?

$
0
0

Hi All,

I need to install Xamarin.Android.Support.Fragment which requires at least Mono.Android 8.0. I have targeted version 8.0 but when I try to install it somehow shows that I am targeting version 6.0.

Kindly help me to resolve this issue.


HttpClient using Xamarin Forms

$
0
0

I'm working on a Xamarin forms application and not sure if this is an error triggered by C#/HttpClient or by Xamarin Forms.

In my Xamarin Forms application, I have a RequestService class that contains the following code:

public class RequestService : IRequestService
{
    private static HttpClient instance;
    private static HttpClient HttpClientInstance => instance ?? (instance = new HttpClient(new NativeMessageHandler() { EnableUntrustedCertificates = true, DisableCaching = true }));
    public async Task<TResult> GetAsync<TResult>(string uri, string token = "")
    {
        setupHttpClient(token);
        HttpResponseMessage response = await HttpClientInstance.GetAsync(uri).ConfigureAwait(false);
        await HandleResponse(response);
        string responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
        return await Task.Run(() => JsonConvert.DeserializeObject<TResult>(responseData));
    }

    private void setupHttpClient(string token = "")
    {
        HttpClientInstance.DefaultRequestHeaders.Accept.Clear();
        HttpClientInstance.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        if (!string.IsNullOrWhiteSpace(token))
        {
            HttpClientInstance.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", token);
        }
    }

    private async Task HandleResponse(HttpResponseMessage response)
    {
        if (!response.IsSuccessStatusCode)
        {
            var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
            if (response.StatusCode == HttpStatusCode.Forbidden || response.StatusCode == HttpStatusCode.Unauthorized)
            {
                throw new Exception(content);
            }
            throw new HttpRequestException(content);
        }
    }
}

It has been working quite well for the last 5 to 7 days but today it started crashing without any errors.Any request just exits the application.

I managed to debug and trace successful execution until the line:

 HttpResponseMessage response = await HttpClientInstance.GetAsync(uri).ConfigureAwait(false);

It is on this line that it tries to do something and then just exits the app. The Debug console for that line shows the following:

Thread started:  #3
05-14 10:20:51.974 D/Mono    (20217): Assembly Ref addref ModernHttpClient[0x7028fef180] -> System[0x701365c000]: 15
05-14 10:20:51.986 D/Mono    (20217): Assembly Ref addref ModernHttpClient[0x7028fef180] -> System.Core[0x701439c500]: 10
05-14 10:20:52.098 D/Mono    (20217): DllImport searching in: '__Internal' ('(null)').
05-14 10:20:52.098 D/Mono    (20217): Searching for 'java_interop_jnienv_new_object_array'.
05-14 10:20:52.098 D/Mono    (20217): Probing 'java_interop_jnienv_new_object_array'.
05-14 10:20:52.098 D/Mono    (20217): Found as 'java_interop_jnienv_new_object_array'.
05-14 10:20:52.101 D/Mono    (20217): DllImport searching in: '__Internal' ('(null)').
05-14 10:20:52.101 D/Mono    (20217): Searching for 'java_interop_jnienv_set_object_array_element'.
05-14 10:20:52.101 D/Mono    (20217): Probing 'java_interop_jnienv_set_object_array_element'.
05-14 10:20:52.101 D/Mono    (20217): Found as 'java_interop_jnienv_set_object_array_element'.
05-14 10:20:52.107 D/Mono    (20217): DllImport searching in: '__Internal' ('(null)').
05-14 10:20:52.107 D/Mono    (20217): Searching for 'java_interop_jnienv_get_object_array_element'.
05-14 10:20:52.107 D/Mono    (20217): Probing 'java_interop_jnienv_get_object_array_element'.
05-14 10:20:52.107 D/Mono    (20217): Found as 'java_interop_jnienv_get_object_array_element'.
05-14 10:20:52.213 D/Mono    (20217): DllImport searching in: '__Internal' ('(null)').
05-14 10:20:52.214 D/Mono    (20217): Searching for 'java_interop_jnienv_call_boolean_method'.
05-14 10:20:52.214 D/Mono    (20217): Probing 'java_interop_jnienv_call_boolean_method'.
05-14 10:20:52.214 D/Mono    (20217): Found as 'java_interop_jnienv_call_boolean_method'.
05-14 10:20:52.348 F/        (20217): /Users/builder/jenkins/workspace/xamarin-android-d15-6/xamarin-android/external/mono/mono/mini/debugger-agent.c:4846: (null) assembly:mscorlib.dll type:BadImageFormatException member:<none>

A few things to note here are as follows:

  1. I'm using ModernHttpClient
  2. The settings under Android Project -> Properties -> Android Options -> are:
    HttpClient Implementation = Android
    SSL/TLD Implementation = Native TFS 1.2+
  3. I have also tried wrapping that line in a try...catch block but the control never gets to the exception section ut rather just exits.

I have reproduced the issue in a simple solution hosted here.

Has anybody come across this issue? Any assistance would be greatly appreciated.

Thanks

Images in carouselview are resized when I change the orientation of the device to horizontal

$
0
0

when i change the orientation some section of the image is not visible

I'll show the code i'm using

<Grid RowSpacing="0">
  <Grid.RowDefinitions>
    <RowDefinition Height=".3*"/>
    <RowDefinition Height=".7*"/>
  </Grid.RowDefinitions>
  <cv:CarouselView ItemsSource="{Binding Zoos}" x:Name="CarouselZoos">
    <cv:CarouselView.ItemTemplate>
      <DataTemplate>
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
          </Grid.RowDefinitions>
          <Image Grid.RowSpan="2" Aspect="AspectFill" Source="{Binding ImageUrl}"/>
          <StackLayout Grid.Row="1" BackgroundColor="#80000000" Padding="12">
            <Label TextColor="White" Text="{Binding Name}" FontSize="16" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
          </StackLayout>
        </Grid>
      </DataTemplate>
    </cv:CarouselView.ItemTemplate>
  </cv:CarouselView>
</Grid>

HttpClient using Xamarin Forms

$
0
0

I'm working on a Xamarin forms application and not sure if this is an error triggered by C#/HttpClient or by Xamarin Forms.

In my Xamarin Forms application, I have a RequestService class that contains the following code:

public class RequestService : IRequestService
{
    private static HttpClient instance;
    private static HttpClient HttpClientInstance => instance ?? (instance = new HttpClient(new NativeMessageHandler() { EnableUntrustedCertificates = true, DisableCaching = true }));
    public async Task<TResult> GetAsync<TResult>(string uri, string token = "")
    {
        setupHttpClient(token);
        HttpResponseMessage response = await HttpClientInstance.GetAsync(uri).ConfigureAwait(false);
        await HandleResponse(response);
        string responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
        return await Task.Run(() => JsonConvert.DeserializeObject<TResult>(responseData));
    }

    private void setupHttpClient(string token = "")
    {
        HttpClientInstance.DefaultRequestHeaders.Accept.Clear();
        HttpClientInstance.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        if (!string.IsNullOrWhiteSpace(token))
        {
            HttpClientInstance.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", token);
        }
    }

    private async Task HandleResponse(HttpResponseMessage response)
    {
        if (!response.IsSuccessStatusCode)
        {
            var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
            if (response.StatusCode == HttpStatusCode.Forbidden || response.StatusCode == HttpStatusCode.Unauthorized)
            {
                throw new Exception(content);
            }
            throw new HttpRequestException(content);
        }
    }
}

It has been working quite well for the last 5 to 7 days but today it started crashing without any errors.Any request just exits the application.

I managed to debug and trace successful execution until the line:

 HttpResponseMessage response = await HttpClientInstance.GetAsync(uri).ConfigureAwait(false);

It is on this line that it tries to do something and then just exits the app. The Debug console for that line shows the following:

Thread started:  #3
05-14 10:20:51.974 D/Mono    (20217): Assembly Ref addref ModernHttpClient[0x7028fef180] -> System[0x701365c000]: 15
05-14 10:20:51.986 D/Mono    (20217): Assembly Ref addref ModernHttpClient[0x7028fef180] -> System.Core[0x701439c500]: 10
05-14 10:20:52.098 D/Mono    (20217): DllImport searching in: '__Internal' ('(null)').
05-14 10:20:52.098 D/Mono    (20217): Searching for 'java_interop_jnienv_new_object_array'.
05-14 10:20:52.098 D/Mono    (20217): Probing 'java_interop_jnienv_new_object_array'.
05-14 10:20:52.098 D/Mono    (20217): Found as 'java_interop_jnienv_new_object_array'.
05-14 10:20:52.101 D/Mono    (20217): DllImport searching in: '__Internal' ('(null)').
05-14 10:20:52.101 D/Mono    (20217): Searching for 'java_interop_jnienv_set_object_array_element'.
05-14 10:20:52.101 D/Mono    (20217): Probing 'java_interop_jnienv_set_object_array_element'.
05-14 10:20:52.101 D/Mono    (20217): Found as 'java_interop_jnienv_set_object_array_element'.
05-14 10:20:52.107 D/Mono    (20217): DllImport searching in: '__Internal' ('(null)').
05-14 10:20:52.107 D/Mono    (20217): Searching for 'java_interop_jnienv_get_object_array_element'.
05-14 10:20:52.107 D/Mono    (20217): Probing 'java_interop_jnienv_get_object_array_element'.
05-14 10:20:52.107 D/Mono    (20217): Found as 'java_interop_jnienv_get_object_array_element'.
05-14 10:20:52.213 D/Mono    (20217): DllImport searching in: '__Internal' ('(null)').
05-14 10:20:52.214 D/Mono    (20217): Searching for 'java_interop_jnienv_call_boolean_method'.
05-14 10:20:52.214 D/Mono    (20217): Probing 'java_interop_jnienv_call_boolean_method'.
05-14 10:20:52.214 D/Mono    (20217): Found as 'java_interop_jnienv_call_boolean_method'.
05-14 10:20:52.348 F/        (20217): /Users/builder/jenkins/workspace/xamarin-android-d15-6/xamarin-android/external/mono/mono/mini/debugger-agent.c:4846: (null) assembly:mscorlib.dll type:BadImageFormatException member:<none>

A few things to note here are as follows:

  1. I'm using ModernHttpClient
  2. The settings under Android Project -> Properties -> Android Options -> are:
    HttpClient Implementation = Android
    SSL/TLD Implementation = Native TFS 1.2+
  3. I have also tried wrapping that line in a try...catch block but the control never gets to the exception section ut rather just exits.

I have reproduced the issue in a simple solution hosted here.

Has anybody come across this issue? Any assistance would be greatly appreciated.

Thanks

Can Xamarin be used as an alternative to Flutter?

$
0
0

I'm considering Xamarin over Flutter. Can someone provide me with some real pros and cons of each?
Specific points that interest me are pricing and ability to handle heavy graphics.

how to get timepicker in xamarin forms

$
0
0

how to get time picker with 12 hours format inuwp xamarin forms

Binding embedded Dictionary in Xamarin forms

$
0
0

Hello guys!

I have a question on Dictionary binding. I have the next structures:

public class Entity
{
     public string Value {get; set;}
     public Color Bgcolor {get; set;}

    public Entity(string val, Color bg)
    {
          Value = val;
          Bgcolor = bg;
    }
}

public class Data
{
     public Dictionary<string,Entity> Entities {get;set;}
     public string Name {get;set;}

     public Data(string n)
     {
          Name = n;

      Entities = new Dictionary<string,Entity>();              
      Entities.Add("apple",new Entity("Noname",Color.White));
          Entities.Add("plum",new Entity("Xamarin",Color.FloralWhite));
          .....
     }
}

public class EntityDataClass
{
      public List<Data> collection {get;set;}

      public EntityDataClass()
      {
             collection = new List<Data>();

             collection.Add(new Data("FirstName"));
      }
      ....
}

How can I bind these structs in a ListView IN XAML, for example I would like to bind the collection[0].Name and collection[0].Entities["apple"].Bgcolor and Value?

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"          
             x:Class="EntityDataClass">

 <ListView Margin="10"  ItemsSource="{Binding collection}" HasUnevenRows="true">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <StackLayout>
                                      <Label Text="{Binding Name}" />
                          <Label x:Name="EntityValueApple" Text="{Binding ????apple value???}" BackgroundColor="{Binding ????apple bgcolor????}" />
                                      <Label x:Name="EntityValuePlum" Text="{Binding ????plum value????}" BackgroundColor="{Binding ????plum bgcolor????}" />
                                </StackLayout>
                           </ViewCell>
                         </DataTemplate>
                     </ListView.ItemTemplate>
</ListView>
</ContentPage>

Thank you very much.

Tree View in Xamarin forms.

$
0
0

Hello guys,
Is there any way to implement Tree View in Xamarin forms ? If yes then please let me know how ?

Thank you.


Showing Navigation Bar instead of Back Button within a detail page

$
0
0

I chose a Master Detail Page as main page. My detail pages are content pages.
If the user is on the first/start page and clicks a button, another page will be pushed via Navigation.PushAsync(). On this page, normally the back button will be shown. But I don't need the back button there. I need the navigation icon to open the menu.
How can I do this? I just know that I can dispose th back button..
Setting NavigationPage.HasNavigationBar to true doesn't change anything..

And how can I prevent the users from clicking the back button from their smartphone?

how to Detect Touch event EVERYWHERE !?

$
0
0

Hello,

i created a View component that i use in every page of my application mobile.
in this view component i want to detect every touch on the root page ( i know how to detect touch on my component by adding GestureRecognizers )

i think it's possible to handle this information because in debug mode every time i touch the screen a line on the console appear :
07-26 10:24:17.541 I/ViewRootImpl(29702): ViewRoot's Touch Event : ACTION_UP
07-26 10:24:18.149 I/ViewRootImpl(29702): ViewRoot's Touch Event : ACTION_DOWN

so if i could handle this event in my application ... but i don't know how !

Thx to help me ^^

Using Barcode Hardware Scanner on UWP/Android

$
0
0

Has anyone tackled this in both environments? I have a few specifec Windows 10 devices Getac and Juniper Mesa2 ... any guidance would be aprreciated

mscorlib conflict

$
0
0

I created a new xamarin forms app for android and ios and the code generated by visual studio does not even compile. I get this error:

No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.

This bug has been there for about a month and none of the solutions I have found anywhere, including this forum, have worked. Does anyone know how to solve this?

The real question is, how in hell is Microsoft so stupid that they would have a tool where their generated code does not even compile?

listview with CachingStrategy="RecycleElement" not respond to OnPropertyChanged

$
0
0

hello

i got a listview that bind to vm having CachingStrategy="RecycleElement" that dose not respond to OnPropertyChanged..
without the RecycleElement its working fine..

this is the vm

    private DateTime _pickerDateMMYY;

    public List<TimeRoll_M> TimeRollsReverse
    {
        get
        {
            if (_TimeRollsReverse == null)
                FilterShifts();

            return _TimeRollsReverse;
        }
    }

   private void FilterShifts()
   {    
         //some data filter...
        _TimeRollsReverse = mydata; // the prop setter is here
        _TimeRollsReverse.Reverse();
        OnPropertyChanged("TimeRollsReverse");
   }

the xaml

          < !-- CachingStrategy="RecycleElement"-- >
          <ListView 
                Margin="0,20"
                ItemsSource="{Binding TimeRollsReverse, Mode=OneWay}"
                HasUnevenRows="True"
                x:Name="LstTimeRolls"
                ItemTapped="LstTimeRolls_ItemTapped"
                HorizontalOptions="StartAndExpand"
                SelectedItem="{Binding CurrentTimeRoll, Source={x:Static local:BaseRolls_VM.Rolls_Instance} ,Mode=TwoWay}"
                >

thanks

Viewing all 81910 articles
Browse latest View live


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