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

Xamarin.Forms bug? System.ObjectDisposedException: Cannot access a disposed object

$
0
0

Hi,

My Android Xamarin.Forms application uses a Navigation stack to display various views, I often have a list on a screen (A) that once a cell is clicked I push onto the stack a new screen (B), the user completes some form fields and then clicks a button to save. Once they click the 'save' button a task is created on the thread pool to asynchronously perform some work (no async/await and no dependency on any UI) and the view is popped back to screen (A).

Once the task is completed, it fires a simple event using the PubSub library, on the UI thread, so screen (A) has the opportunity to refresh from the local database and it does.

The problem is that when I go to drag the updated list on screen (A), the app crashes with an ObjectDisposedException intermittently (like 1 in 50 times)...

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Android.Views.GestureDetector'.
  at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00030] in /Users/builder/data/lanes/3819/c1d1c79c/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.cs:153
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00002] in /Users/builder/data/lanes/3819/c1d1c79c/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:57
  at Android.Views.GestureDetector.OnTouchEvent (Android.Views.MotionEvent ev) [0x0002c] in /Users/builder/data/lanes/3819/c1d1c79c/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.GestureDetector.cs:1546
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Android.Views.View.IOnTouchListener.OnTouch (Android.Views.View v, Android.Views.MotionEvent e) [0x0003f] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:101
  at Android.Views.View+IOnTouchListenerInvoker.n_OnTouch_Landroid_view_View_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v, System.IntPtr native_e) [0x00019] in /Users/builder/data/lanes/3819/c1d1c79c/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.View.cs:3558
  at at (wrapper dynamic-method) System.Object:4eaabbb9-8c1c-4ea1-b505-44c325bbb1ab (intptr,intptr,intptr,intptr)

I'm not sure why it says that I cannot access a disposed object, I'm interacting with a list with a gesture detector, it's on-screen, so it's not disposed.

Is this a bug in Xamarin.Forms?

On a similar note, if I modify an MVVP property that notifies listeners that a property has changed (I always check it's on the UI thread first), then if that's bound to a Xamarin.Forms list but it's not currently on-screen, presumably Xamarin.Forms will not barf ? After-All it's just off-screen and should still bind okay?


ListView space issue when HasUnevenRows=true. Need a solution.

$
0
0

Hi All,

I'm working on a simple listview structure. My requirement is basically to show elements in list. I want HasUnevenRows=true because few elements are single lined & few are multi lined.
Here is the code snippet I'm using.

<ListView ItemsSource="{Binding FireOrExplosionList}" HasUnevenRows="true" Grid.Row="2">
            <ListView.ItemTemplate>
              <DataTemplate>
              <ViewCell>
                <Label Text="{Binding Path=.}" TextColor="{StaticResource TextColor}" />
              </ViewCell>
              </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

But here the problem is that I'm getting space in the list which is not required. You can see the below image where the space in marked in a rectangle.

Now If I'm changing the code to the following & removing the HasUnevenRows property then the space is not coming but rows in listview are not looking good as they are taking fixed height.

<ListView ItemsSource="{Binding FireOrExplosionList}" RowHeight="25" Grid.Row="2">
            <ListView.ItemTemplate>
              <DataTemplate>
              <ViewCell>
                <Label Text="{Binding Path=.}" TextColor="{StaticResource TextColor}" />
              </ViewCell>
              </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

So my requirement is to enable HasUnevenRows property but get rid of the unwanted space.
Please provide a solution for this.

Thanks,
Priyabrata

How can I scroll to a specific row or section in a ListView

$
0
0

I have a Xamarin.Forms.ListView that contains events that are grouped by date. There are events that occur in future and events that occur in the past.

Users would like to have their screen load with a future event closest to the current date in view so that they do not need to manually scroll down to view it.

What options do I have with a Xamarin.Forms.ListView to accomplish this for iOS and Android users?

Sorry this should have been a question not a discussion

MPMoviePlayerController : Remove black in the screen

$
0
0

Hello,

I manage to use MPMoviePlayerController to display a video as Resource.

My code is :

protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);

        UIGraphics.BeginImageContext(new CGSize(1, 1));
        var fname = Path.Combine(NSBundle.MainBundle.BundlePath, e.NewElement.FileSource);
        var url = NSUrl.FromFilename(fname);
        _moviePlayer = new MPMoviePlayerController {ContentUrl = url};
        _moviePlayer.View.Frame = UIScreen.MainScreen.Bounds;
        UIGraphics.EndImageContext();

        MPMoviePlayerController.Notifications.ObserveLoadStateDidChange(OnLoadStateChanged);
        MPMoviePlayerController.Notifications.ObservePlaybackDidFinish(OnPlaybackComplete);

        SetNativeControl(_moviePlayer.View);

        _moviePlayer.PrepareToPlay();
        _moviePlayer.ShouldAutoplay = true;
        _moviePlayer.RepeatMode = MPMovieRepeatMode.One;
        _moviePlayer.Fullscreen = true;
        _moviePlayer.Play();
    }
    private void OnLoadStateChanged(object sender, NSNotificationEventArgs e)
    {
        if (_moviePlayer.LoadState == MPMovieLoadState.Playable)
        {

        }
    }

    private void OnPlaybackComplete(object sender, MPMoviePlayerFinishedEventArgs e)
    {

    }
}

When I launch my app, the video is working, but I have black at the top and bottom : https://gyazo.com/495cc5809b4a37a76a70919fa2a9e17f
I use the iPad Simulator, with Vertical Orientation.

As you can see, I put Fullscreen to true, I want the real fullscreen even if resolution and clarity of my video is bad.

Could you help me ?

Regards

MVVMCross Forms + MasterDetail Android error

$
0
0

I'm trying to implement Master Detail Page and MVVMCross,
it works fine on ios, but on android I'm getting this error : android only allows one navigation page on screen at a time

This is my MainActivity.cs
` public class MainActivity : FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

        Forms.Init(this, bundle);

        var mvxFormsApp = new MvxFormsApp();
        LoadApplication(mvxFormsApp);

        var presenter = Mvx.Resolve<IMvxViewPresenter>() as MvxFormsDroidPagePresenter;
        presenter.MvxFormsApp = mvxFormsApp;
        Mvx.Resolve<IMvxAppStart>().Start();


    }
}`

App.cs
` public override void Initialize()
{
try
{
CreatableTypes()
.EndingWith("Service")
.AsInterfaces()
.RegisterAsLazySingleton();

            RegisterAppStart<ViewModels.RootViewModel>();

            InitializeDb(false); 
            InitSettings();
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Message);
        }
    }`

RootPage.xaml:
`<?xml version="1.0" encoding="UTF-8"?>
<MasterDetailPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyClass.RootPage"
Title="Welcome"

IsPresented="false">


`

RootPage.xaml.cs:
` public partial class RootPage : MasterDetailPage
{

    public RootPage()
    {
        InitializeComponent();
        NavigationPage.SetHasNavigationBar(this, false);
        InitializeMasterDetail();
    }

    private void InitializeMasterDetail()
    {            
        this.SetValue(NavigationPage.BarTextColorProperty, Color.White);
        Master = new MainMenuPage();
        Detail = new NavigationPage(new DashboardPage());
    }

    protected override void OnAppearing()
    {
        base.OnAppearing();

    }
}`

Setting a header of a grid in a listview

$
0
0

Hey, I am trying to add a header to my listview. My listview contents will be a grid, so the column sizes will change dynamically. I have tried using listview.header, but the size of the header column is not related to the grid so does not size appropriately.

I have also tried adding another row in the grid. The first one being the header. But as expected, this duplicates for each row of the listview. Is there an easy way to do this, or to say, this is first row in listview, so only display header on this row?

Here is my code

<ListView ItemsSource="{Binding Orders}" HorizontalOptions="Center">
          <ListView.Header>
              <StackLayout Orientation="Horizontal" BackgroundColor="Black">
                <Label Text="Product" />
                <Label Text="Quantity" />
              </StackLayout>
          </ListView.Header>
          <ListView.ItemTemplate>
            <DataTemplate>
              <ViewCell>
                <Grid Style="{StaticResource GridInListViewStyle}" HorizontalOptions="Center" >
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="75"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                  </Grid.RowDefinitions>
                  <Label  Text="Product" BackgroundColor="Green" Grid.Column="0" Grid.Row="0" />
                  <Label Text="Quantity" BackgroundColor="Green" Grid.Column="1" Grid.Row="0"/>
                  <StackLayout Orientation="Horizontal" Grid.Column="0" Grid.Row="1" Padding="10, 0, 0, 0">
                    <Label Text="{Binding ProductName}" VerticalOptions="Center" />
                  </StackLayout>
                  <Entry Keyboard="Numeric" Grid.Column="1" Grid.Row="1" VerticalOptions="Center"/>
                </Grid>
              </ViewCell>
            </DataTemplate>
          </ListView.ItemTemplate>
        </ListView>

Attached is current layout

Thanks

Hanselman forms

ContentPage/NavigationPage, ToolbarItems and Navigation.PushAsync

$
0
0

I am currently trying to push a new page with a toolbar on top, so I tried:

public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();

            this.ToolbarItems.Add(new ToolbarItem {
                Text = "Config",
                Order = ToolbarItemOrder.Secondary,
                Command = new Command(async () => 
                {
                    //await Navigation.PushAsync(new ConfigPage1(), true); // doesn't work on Android
                    await Navigation.PushModalAsync(new ConfigPage1(), true); // I can't see the toolbar
                    //await Navigation.PushModalAsync(new ConfigPage2(), true); // doesn't work --> "Sequence contains no elements" error
                })
            });
        }
    }

with

public partial class ConfigPage1 : ContentPage 
{
    public ConfigPage1()
    {
        InitializeComponent();

        this.ToolbarItems.Add(new ToolbarItem { Text = "Config1" });
    }
}

and

public partial class ConfigPage2 : NavigationPage
{
    public ConfigPage2()
    {
        InitializeComponent();

        this.ToolbarItems.Add(new ToolbarItem { Text = "Config2" });
    }
}

How can I display ToolbarItem on a pushed ContentPage ?
or
How can I push a NavigationPage ?


Pinch and Pan gesture recognizers not working on Android project

$
0
0

I'm using a custom ContentView object with three different gesture recognizers: TapGestureRecognizer, PinchGestureRecognizer and PanGestureRecognizer (using Xamarin.Forms 2.0.1).

Here's the custom ContentView constructor where I defined the gesture recognizers...

// Constructor
public ImageContainer() 
        {
            TapGestureRecognizer tapGesture = new TapGestureRecognizer();
            PinchGestureRecognizer pinchGesture = new PinchGestureRecognizer();
            PanGestureRecognizer panGesture = new PanGestureRecognizer();        
            tapGesture.NumberOfTapsRequired = 2;
            tapGesture.Tapped += OnTapEvent; // event handler not getting called on Android
            pinchGesture.PinchUpdated += OnPinchUpdated;
            panGesture.PanUpdated += OnPanUpdated; // event handler not getting called on Android
            GestureRecognizers.Add(tapGesture);
            GestureRecognizers.Add(pinchGesture);
            GestureRecognizers.Add(panGesture);
        }

All three gesture recognizers work as expected on Windows Phone 8.1 and iOS.
The issue I'm having is that on Android the tap and pan gesture recognizers are not working, their event handlers are not even getting called and I'm not getting any errors.
Any ideas?

Thank you.

how to align Label control horizontally in listview

$
0
0

hello,
I'm new to xamarin forms (I used to develop on wp/xaml)
I have a chat in my app, and I would like to display the message left or right according to the sender (ex: me on the left the other one on the right, like sms)

<ListView.ItemTemplate>
        <DataTemplate>
          <ViewCell >
            <ViewCell.View >
             <StackLayout HorizontalOptions="Center" BackgroundColor="White" Orientation="Horizontal" WidthRequest="270">
                <Label WidthRequest="230" HorizontalOptions="End" IsVisible="{Binding isText}"  Grid.Row="1"  TextColor="Black" Text="{Binding msg}" Font="15,Bold" />
              </StackLayout>
            </ViewCell.View>
          </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>

I think the StackLayout is not the one I should use.
any idea of which container to use to align the label horizontally right or left?thanks in advance!

How do you pass multiple arguments in the MessagingCenter?

$
0
0

We're trying to implement a DisplayAlert bridge between our ViewModel and View by using the MessagingCenter. We wanna pass the title and the message as parameters to the message.

We tried this, which does not work. This is probably an easy one, but it's not explicit (enough for us) in the documentation, there's just an example with 1 string parameter.

MessagingCenter.Subscribe<MainPage, string, string> (this, "DisplayAlert", (sender, title, message) => {
    DisplayAlert(title, message, "Ok");
});

Custom Button Renderer - size issues on Android (maybe iOS)

$
0
0

Hi,

I'm rendering a custom button and it looks good but the size of the Android element is weird. The custom button is very simple.
In my PCL I have this:

public class ImageButton : Button
{
    public ImageButton()
    {
        BackgroundColor = Color.Transparent;
    }
}

In my Android project I have this class:

[assembly: ExportRenderer(typeof(mahana.CustomControls.ImageButton), typeof(ImageButtonRenderer))]
namespace foo.Droid.CustomControls
{
    public class ImageButtonRenderer : ButtonRenderer
    {
        protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime)
        {
        // canvas.Width/Height and child.Width/Height are OK here - 1020 width and 144 height
            return base.DrawChild(canvas, child, drawingTime);
        }

        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
        {
            base.OnElementChanged(e);
            // e.NewElement.Width and e.NewElement.Height are both -1
            SetBackgroundResource(Resource.Drawable.bg_button_border);
        }

        protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
        {
            // widthMeasureSpec and heightMeasureSpec are extremely high, e.g. 10796174218
            base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
        }
    }
}

I render this element in a StackPanel without WidthRequest / HeightRequest. The button has a good size and the BackgroundResource from the Droid project also looks good. In DrawChild, both canvas and child have good sizes (1020x144). But the sizes in OnElementChanged() and OnMeasure() seems to be incorrect.

When I tap far outside my button, then the Android Drawable "OnPressed" effect becomes active. So whenever I click anywhere on my screen - the button has a click effect (Ripple effect) even if I don't press the element. So the canvas and child elements seems OK but some measurement for the custom renderer is way off so that it covers the entire screen and listens to all click events, even outside the button.

I hope the problem is clear. Does anyone know why this is happening and how I can prevent it? What can cause this custom renderer to listen for click effects far outside the canvas/child bounds?

Different Xamarin Forms View per platform

$
0
0

Hi,

I have started using the FFImageLoading CachedImage view in my app however this is not supported in the version of Windows Phone I am targeting so none of my images are shown, so I have an idea about using a custom view (MyImage) and then replacing this with either a CachedImage, for Android and iOS or a standard Image, for Windows Phone.

I am not exactly sure how this would be achieved, I am thinking I could do it with a custom renderer by calling SetNativeControl, which seems to work for Windows Phone however I am not sure how to do the same for Android and iOS.

I have seen there is a SetElement method but this doesn't seem to work when I call it with a new instance of a CachedImage.

Does anyone have an ideas how I might be able to achieve this?

Thank you for taking the time to read this.

Paul Diston

Firebase.Xamarin

$
0
0

I'm trying to write with user authentication, as with the rules of the default server. auth! = null ...
using the basic method, I have the error BAD 400 ...
help me?

var item = await firebase
.Child("yourentity")
.WithAuth(auth.FirebaseToken)
.PostAsync(new YourObject());

someone who ultiliza firebase ... have any idea and solution?
I'm using the sample
https://github.com/rlamasb/Firebase.Xamarin

https://www.nuget.org/packages/Firebase.Xamarin

when I send without .WithAuth ... it registering, but I want to make more secure about who can save in my bank. because if I let released anyone can send recordings capture and make unfeasible

Nested namespaces in XAML

$
0
0

So I have these 2 line in my xaml (at appropriate locations) to add a custom control to my pages.

    xmlns:local="clr-namespace:AProject;assembly=AProject"

    <local:Nested.AControl/>

Sometimes it works fine, but other times I get an error "Type Nested not found in xmlns clr-namespace:AProject;assembly=AProject" and I have to change it to

    xmlns:nested="clr-namespace:AProject.Nested;assembly=AProject"

    <nested:AControl/>

I can't figure out what causes the namespace to not be found. In fact, in one particular XAML I use two nested namespaces and one works with"local" but the other has to used "nested". Can someone shed any light on the reason this is happening?


ObjectDisposedException on PopToRootAsync with animation

$
0
0

I have a simple page stack and sometimes (not very often) when I get to the end of the page stack and simply asynchronously pop to root with animation, I get this crash.
I hope someone can help me with this.

System.ObjectDisposedExceptionCannot access a disposed object. Object name: 'Android.Graphics.Bitmap'.
Raw
Java.Interop.JniPeerMembers.AssertSelf(IJavaPeerable self)<7839cacb42a9415ab7eaaaa62eb310a4>:0
Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeAbstractVoidMethod(string encodedMember, IJavaPeerable self, JniArgumentValue* parameters)<7839cacb42a9415ab7eaaaa62eb310a4>:0
Android.Graphics.Bitmap.Recycle()<1983e29f997d407f89a085b71f7cc377>:0
Xamarin.Forms.Platform.Android.ButtonDrawable.Reset()<e3d80a9502b84521b638fbb10cce4a8a>:0
Xamarin.Forms.Platform.Android.ButtonDrawable.Dispose(bool disposing)<e3d80a9502b84521b638fbb10cce4a8a>:0
Java.Lang.Object.Dispose()<1983e29f997d407f89a085b71f7cc377>:0
Xamarin.Forms.Platform.Android.ButtonRenderer.Dispose(bool disposing)<e3d80a9502b84521b638fbb10cce4a8a>:0
Java.Lang.Object.Dispose()<1983e29f997d407f89a085b71f7cc377>:0
Xamarin.Forms.Platform.Android.VisualElementRenderer<TElement>.Dispose(bool disposing)<e3d80a9502b84521b638fbb10cce4a8a>:0
Xamarin.Forms.Platform.Android.PageRenderer.Dispose(bool disposing)<e3d80a9502b84521b638fbb10cce4a8a>:0
Java.Lang.Object.Dispose()<1983e29f997d407f89a085b71f7cc377>:0
Xamarin.Forms.Platform.Android.NavigationRenderer.<>c__DisplayClass24_0.<SwitchContentAsync>b__0(Animator a)<e3d80a9502b84521b638fbb10cce4a8a>:0
Xamarin.Forms.Platform.Android.NavigationRenderer.<>c__DisplayClass24_1.<SwitchContentAsync>b__1(Animator a)<e3d80a9502b84521b638fbb10cce4a8a>:0
Xamarin.Forms.Platform.Android.GenericAnimatorListener.OnAnimationEnd(Animator animation)<e3d80a9502b84521b638fbb10cce4a8a>:0
Android.Animation.AnimatorListenerAdapter.n_OnAnimationEnd_Landroid_animation_Animator_(IntPtr jnienv, IntPtr native__this, IntPtr native_animation)<1983e29f997d407f89a085b71f7cc377>:0
at (wrapper dynamic-method) System.Object:8b2acc1f-a106-400a-897c-a3654985c6bf (intptr,intptr,intptr)

Add Droid project to existing solution

$
0
0

I have been developing my xamarin forms PCL app over the last year but only had an IOS project within the solution. Time has come to also deploy to Droid so need to add a project in. What I thought would be the easiest way was to create a totally new forms solution, copy the Droid project in to my project and "Add existing project". At this point it appears in my solution as expected but when I build I get the following error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.iOS.dll'

Why would the Droid project be referencing Xamarin.iOS.dll? Is there some settings I need to change in my solution? When I click on the error it opens up Xamarin.Android.Common.targets and there is no reference in there to iOS

Thanks,
Richard

Error: Could not AOT the assembly Mono.Android.dll (XA3001)

$
0
0

When I compile my XF project for Android in Release mode, I get this error:

Error XA3001: Could not AOT the assembly: obj/Release/android/assets/Mono.Android.dll (XA3001)

I looked in the Packaging log, and there is a very long piece of the log with an "Error: branch out of range" message:

[AOT] /Users/Emanuele/Projects/Testbed/Droid/obj/Release/android/assets/Mono.Android.dll Mono arguments: --aot=outfile=/Users/Emanuele/Projects/Testbed/Droid/obj/Release/aot/armeabi-v7a/libaot-Mono.Android.dll.so,asmwriter,mtriple=armv7-linux-gnueabi,tool-prefix=/Users/Emanuele/Library/Developer/Xamarin/android-ndk/android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-,ld-flags=,llvm-path=/Library/Frameworks/Xamarin.Android.framework/Versions/Current/bin,temp-path=/Users/Emanuele/Projects/Testbed/Droid/obj/Release/aot/armeabi-v7a /Users/Emanuele/Projects/Testbed/Droid/obj/Release/android/assets/Mono.Android.dll MONO_PATH=/Users/Emanuele/Projects/Testbed/Droid/obj/Release/android/assets [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od: Assembler messages: [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:3995711: Error: branch out of range [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:3995712: Error: branch out of range [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:3995713: Error: branch out of range [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:3995714: Error: branch out of range [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:3995715: Error: branch out of range [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:3995716: Error: branch out of range [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:3995717: Error: branch out of range [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:3995718: Error: branch out of range .... (omissis of 1000+ lines like those above) .... [aot-compiler stderr] /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od:4021772: Error: branch out of range [aot-compiler stderr] AOT of image /Users/Emanuele/Projects/Testbed/Droid/obj/Release/android/assets/Mono.Android.dll failed. [aot-compiler stdout] Mono Ahead of Time compiler - compiling assembly /Users/Emanuele/Projects/Testbed/Droid/obj/Release/android/assets/Mono.Android.dll [aot-compiler stdout] AOTID 97BE0680-C193-21FE-6C20-37E5DB162784 [aot-compiler stdout] Code: 30817536(78%) Info: 2298190(5%) Ex Info: 3006829(7%) Unwind Info: 176828(0%) Class Info: 910128(2%) PLT: 9732(0%) GOT Info: 1362534(3%) Offsets: 831305(2%) GOT: 750128 [aot-compiler stdout] Compiled: 131116/131116 (100%), No GOT slots: 12433 (9%), Direct calls: 79902 (45%) [aot-compiler stdout] Executing the native assembler: "/Users/Emanuele/Library/Developer/Xamarin/android-ndk/android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-as" -mfpu=vfp3 -o /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od.o /var/folders/mh/bdld1w81749d6stnnz77cqxr0000gn/T/mono_aot_3rM2od
error XA3001: Could not AOT the assembly: obj/Release/android/assets/Mono.Android.dll
Task "Aot" execution -- FAILED
Done building target "_BuildApkEmbed" in project "/Users/Emanuele/Projects/Testbed/Droid/Testbed.Droid.csproj".-- FAILED

I tryed to change the Linker behaviour, and tried both "Don't Like" and "Link only SDK Assemblies" options, but the result is the same.

large page without scrollview (listview inside)

$
0
0

Hi, I have a large page with editors and listviews and it doesn't fit in a page, so I use Scrollviews but it seems that I should not use listviews inside scrollviews, how can I use listviews in large pages that need scrolling?

in addition I have editors and in IOS I need that when the keyboard appears it scrolls to maintain the text of editor visible and for that I think that I need the scrollview.

and I want to control the gestures in the listview but in Android it gets two events, one for the listview and another for the scrollview so I have problems because I receive the event for the scroll and then pop the page and then comes the event for the listview but the page doesn't exists and it crash..

Graphics, SkiaSharp

$
0
0

Hi all,

I am currently looking at the SkiaSharp Example here: https://developer.xamarin.com/guides/cross-platform/drawing/introduction/#Obtaining_an_SKCanvas.

It seem's easy enough and i implemented my code as the following:

    public TestController()
    {
        InitializeComponent();
        DrawXamagon();
    }

    protected void DrawXamagon() { 
        using (var surface = SKSurface.Create(width: 640, height: 480, colorType:SKColorType.Rgb565, alphaType: SKAlphaType.Premul))
        {
            SKCanvas canvas = surface.Canvas;

            // clear the canvas / fill with white
            canvas.Clear(SKColors.White);

            // set up drawing tools
            using (var paint = new SKPaint())
            {
                paint.IsAntialias = true;
                paint.Color = new SKColor(0x2c, 0x3e, 0x50);
                paint.StrokeCap = SKStrokeCap.Round;

                // create the Xamagon path
                using (var path = new SKPath())
                {
                    path.MoveTo(71.4311121f, 56f);
                    path.CubicTo(68.6763107f, 56.0058575f, 65.9796704f, 57.5737917f, 64.5928855f, 59.965729f);
                    path.LineTo(43.0238921f, 97.5342563f);
                    path.CubicTo(41.6587026f, 99.9325978f, 41.6587026f, 103.067402f, 43.0238921f, 105.465744f);
                    path.LineTo(64.5928855f, 143.034271f);
                    path.CubicTo(65.9798162f, 145.426228f, 68.6763107f, 146.994582f, 71.4311121f, 147f);
                    path.LineTo(114.568946f, 147f);
                    path.CubicTo(117.323748f, 146.994143f, 120.020241f, 145.426228f, 121.407172f, 143.034271f);
                    path.LineTo(142.976161f, 105.465744f);
                    path.CubicTo(144.34135f, 103.067402f, 144.341209f, 99.9325978f, 142.976161f, 97.5342563f);
                    path.LineTo(121.407172f, 59.965729f);
                    path.CubicTo(120.020241f, 57.5737917f, 117.323748f, 56.0054182f, 114.568946f, 56f);
                    path.LineTo(71.4311121f, 4056f);
                    path.Close();

                    // draw the Xamagon path
                    canvas.DrawPath(path, paint);
                }
            }
        }

I have no errors and the code steps through fine, but noting is displayed (It should display the Xamarin logo). There dosen't seem to be much more to the example, am i supposed to initialise a canvas or Skview in the XAML, or is there any mistakes anybody can see in my example?

Thank you in advanced.

Viewing all 81910 articles
Browse latest View live


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