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

Nested ListViews with MVVM / Prism

$
0
0

Hey there,

does somebody know how to use a ListView with an ObservableCollection as ItemsSource and a ListView.ItemTemplate with another ListView inside? How can I bind data to the inner ObservableCollection Tariffs nested in TariffDays?

            <ListView ItemsSource="{Binding TariffDays}"
                      SelectedItem="{Binding SelectedTariffDay, Mode=TwoWay}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Label Text="{Binding Name}" />

                            <ListView ItemsSource="{Binding Tariffs}">
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <ViewCell>
                                            <Label Text="{Binding StartTime}" />
                                        </ViewCell>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>

                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

It's not working at all and I read that this is not working in Xamarin, but how can I achieve this anyway without breaking the rules?

Cheers


WebViewRenderer.OnElementChanged gets called with null native control on Xamarin Forms 2.5

$
0
0

I am using my own customrenderer for Webviews it has always worked but since I upgraded Xamarin Forms nuget package to version 2.5 it crashes because it seems like the member method OnElementChanged is called with null Native control and null thisActivity. any idea how to fix it?

this is the error I get:

    Unhandled Exception:

    System.ArgumentNullException: Value cannot be null.
    Parameter name: thisActivity

How to manually sign an APK file ?

$
0
0

With VS2015 I'm unable to generate a signed APK. I got the error 'The package appears to be corrupted' even if i signed using Signing Identity. Can I manually sign the APK ?

Can't get the PinchToZoomContainer working

$
0
0

I already posted this question on the general forum, but i think that it rather belongs here.
This is my original post: "Hi all!
Im quite new to Xamarin and i have been working on an App for the last 2 weeks using xamarin.forms. I need to make a page which is zoomable by a regular pinch gesture. I have tried the online example at the official xamarin.forms page(can't post links yet sorry)
This solution however will result in a white page with absolutely no content(It doesnt matter which element i set as the content of the wrapper in XAML).
P.S: it will also show me a blank page, if the Content of the page is only the wrapper and a label added manually to the content of the wrapper in the constructor, also I'm testing on all systems IOS Android and UWP"

Font symbols coding format

$
0
0

Hello everybody! Anybody know this fonts symbols will apear in all platforms and version: ✩ ✪ ✫ ✬ ✭ ✮ ✮ ✯ ✰ ✲ ✲ ✳ ✳? They does not suport coding format ANSI. So it will be a problem to use this symbols?

how to get the coordinates where there is a control on the screen?

$
0
0

how could I get the coordinates of x, and a control image??

How to get X and Y coordinate of a listview item?

$
0
0

I want X and Y coordinate of a litview item.so to get this in xamarin forms?

Help with Firebase for Xamarin Forms

$
0
0

Hi,

I am trying to get the Firebase Analytics works for my Xamarin Forms.

Here what I did:

**In Droid Project:
—————————————————

MainActivity.cs:
**

using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Com.OneSignal;
using Syncfusion.SfBusyIndicator.XForms.Droid;
using Syncfusion.ListView.XForms.Android;
using Syncfusion.SfPullToRefresh.XForms.Android;
using Syncfusion.SfNavigationDrawer.XForms.Droid;
using Firebase.Iid;
using Firebase.Analytics;
using Firebase.Crash;

namespace Eithar.Droid
{
    [Activity(Label = "Eithar", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        FirebaseAnalytics firebaseAnalytics;

        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            // Obtain the FirebaseAnalytics instance.
            firebaseAnalytics = FirebaseAnalytics.GetInstance(this);

            LoadApplication(new App());
        }
    }
}

**FirebaseService.cs
**

using System;
using Android.Content;
using Xamarin.Forms;
using Firebase.Analytics;
using Firebase.Crash;
using Android.OS;

[assembly: Dependency(typeof(Eithar.Droid.FirebaseService))]
namespace Eithar.Droid
{
    public class FirebaseService : IFirebaseService
    {
        FirebaseAnalytics firebaseAnalytics;

        public void Track_App_Page(String PageNameToTrack)
        {
            firebaseAnalytics.SetCurrentScreen(new Android.App.Activity(), "HomePage", "main_screen");
        }
    }
}

**In PCL Project:
———————————————

IFirebaseService.cs
**

using System;

namespace Eithar
{
    public interface IFirebaseService
    {
        void Track_App_Page(String PageNameToTrack);
    }
}

FirebaseDependencyService.cs

using System;
using Xamarin.Forms;

namespace Eithar
{
    public static class FirebaseDependencyService
    {
        public static void Track_App_Page(String PageNameToTrack)
        {
            DependencyService.Get<IFirebaseService>().Track_App_Page(PageNameToTrack);
        }
    }
}

Home.xaml.cs:

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

    FirebaseDependencyService.Track_App_Page("HomePage");
}

google-services.json is already added to the project and the Build action is set to GoogleServicesJson

but my app crashes on appearing and it works back when I comment:

// FirebaseDependencyService.Track_App_Page("HomePage");


Where is the problem here please?

Thanks,
Jassim


Access ViewModel inside CustomRenderer

$
0
0

Hello everyone :)

I'm trying to implement a long press behavior on a switch control. I have a custom switch renderer in which I use the "Long click" event:

[assembly: ExportRenderer(typeof(CustomSwitch), typeof(CustomSwitchRenderer))]

namespace Version1.Droid
{
    public class CustomSwitchRenderer : SwitchRenderer
    {
        public CustomSwitchRenderer(Context context): base(context) {}

        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Switch> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                Control.LongClick += Control_LongClick;
            }
        }

        private async void Control_LongClick(object sender, LongClickEventArgs e)
        {
            var answer = await App.Current.MainPage.DisplayAlert("Title", "Blablablabla?", "Yes", "No");
            if (answer)
            {
                //Access binding context of the switch ???
            }
        }
    }
}

How could I access the binding context of the switch inside the LongClick handler ?
I was thinking using the messaging center but I couldn't find any similar example.

Thank you in advance for any help!
Charles

Play video when the view is displayed

$
0
0

I am using Plugin.MediaManager to play video in Xamarin.Forms. I have a ListView with multiple video players. I want to know if it's possible to start playing video when the item in ListView is displayed and also stop playing the item is undisplayed ?

Xamarin Forms - live or die?

$
0
0

I have been writing on C# since about 10 years old. During this time, many interesting and promising technologies have died - Silverlight, Windows Phone, Win RT... It's evolution and business, baby, it's all right. I like Xamarin Forms, despite all the pain that is associated with it. Now I need a remote job, I've been looking for it for a few days. First of all we need native developers -iOS and Android, then developers are needed developer React Native. Also need Xamarin Native developers (much less). But I practically did not meet the proposals for Xamarin Forms. React Native in the beta version but more popular than XF. It seems to me that something goes wrong. Xamarin Forms have 4 years, version 3.0 is on the way but now they are in the role of catching up. A few more years - and the cross-platform battle will be lost, my skills will be unnecessary.
I do not want the Xamarin Forms to die. Need a push, need a transition to a new level. But I'm interested in your opinion.

p.s. Maybe I'm exaggerating, maybe today is not the best day. Maybe it's not in the forms but in my skills. It's just my thoughts.

ContentView calls to ContentPage parent in Xamarin Forms

$
0
0

There are any way to call a method of my parent View (ContentPage) from my actual View (ContentView).

I mean, I want to use ContentView to refresh only a part of the screen, the problem is when I want use methos or propertys of Pages, like IsBusy or DisplayAlert.

Any idea to communicate the View with the Page?

Thank you advanced!

DisplayActionSheet in ContentView

$
0
0

hi,

I have ContentPage (MainPage) with control template, in its Content i am binding ContentView.
`

`

Inside that ContentView i need to get DisplayActionSheet, which is not available for ContentView.

How to use DisplayActionSheet inside ContentView ?

ActivityIndicator when loading a page

$
0
0

Hello everybody!

I have a problem, that when you go to the page the user waits a long time until it loads. ActivityIndicator does not save.

I have a very complex layout, and I would like to put it on the download (Show ActivityInicator). My Layout is loaded for about 6 seconds. If I just run Loading, then everything hangs up very much, since Layout has not loaded yet.

Can I run ActivityIndicator smoothly in parallel with loading Layout?

ListView with multiple columns and multiple column-counts per row

$
0
0

I'm looking for a ListView that can support multiple columns (currently using FlowListView) but I also want to have a different column count mid collection.

The use case is really simple, and is based on the images-page from Google: a list with multiple columns is visible and by tapping an item, a new row right below it wil open up but using only one column (ColumnSpan or Expand).

For instance:

Is this possible using FlowListView, or any other control?


How to handle intermittent crashes unrelated to our code in a Xamarin Forms application?

$
0
0

I have an application published on Google Play built using Xamarin Forms. I use the MS App Center to monitor crashes and daily I receive crash information from code unrelated to my application. How us must handle this cases?

Is there any way to better investigate these cases? Should I register a bug for each of them?

Ex1:
java.lang.OutOfMemoryError: Failed to allocate a 20 byte allocation with 0 free bytes and 3GB until OOM
at kh.a(com.google.android.gms.DynamiteModulesB@12221238@12.2.21 (238-188803320):95)
at kh.b(com.google.android.gms.DynamiteModulesB@12221238@12.2.21 (238-188803320):90)
at com.google.maps.api.android.lib6.impl.fn.a(com.google.android.gms.DynamiteModulesB@12221238@12.2.21 (238-188803320):11)
at com.google.maps.api.android.lib6.impl.fp.run(com.google.android.gms.DynamiteModulesB@12221238@12.2.21 (238-188803320):23)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

Ex2:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.higgx.studying/md5f86dd3651b84190e5d2506587b29c5c3.MainActivity}: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.AbsListView$SavedState
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2706)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.-wrap12(ActivityThread.java:-1)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1514)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6205)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
....

Ex3:
Xamarin Exception Stack:
System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer from native handle 0xffc1382c (key_handle 0x3d153b).
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in :0
at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in :0
at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in :0
at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in :0
at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in :0
at Android.Views.View.n_Invalidate (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in :0
at (wrapper dynamic-method) System.Object:a8fd650e-905c-49b3-9edc-1805d8c4a198 (intptr,intptr)
--- End of inner exception stack trace ---
...

Ex4:
java.util.concurrent.TimeoutException: android.view.ThreadedRenderer.finalize() timed out after 10 seconds
at android.view.ThreadedRenderer.nDeleteProxy(ThreadedRenderer.java:-2)
at android.view.ThreadedRenderer.finalize(ThreadedRenderer.java:896)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:222)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:209)
at java.lang.Thread.run(Thread.java:761)

Ex5:
Xamarin Exception Stack:
Java.Lang.Error: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <26daccb04dc641819234102c21fb48e0>:0
at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in <26daccb04dc641819234102c21fb48e0>:0
at Android.Graphics.BitmapFactory.DecodeResource (Android.Content.Res.Resources res, System.Int32 id) [0x00044] in :0
at Android.Graphics.BitmapFactory+<>c__DisplayClass25_0.b__0 () [0x00000] in :0
at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x0000f] in <d361b61194ad4e55becd53788466b04c>:0 at System.Threading.Tasks.Task.Execute () [0x00010] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at Xamarin.Forms.Platform.Android.FileImageSourceHandler+d__4.MoveNext () [0x00144] in <173f39d71f0d4d928f5bbea42e96ffa8>:0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <26daccb04dc641819234102c21fb48e0>:0
at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in <26daccb04dc641819234102c21fb48e0>:0
at Android.Graphics.BitmapFactory.DecodeResource (Android.Content.Res.Resources res, System.Int32 id) [0x00044] in :0
at Android.Graphics.BitmapFactory+<>c__DisplayClass25_0.b__0 () [0x00000] in :0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in :0
at System.Threading.Tasks.Task.Execute () [0x00010] in :0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0

Ex6:
java.lang.IllegalArgumentException: reportSizeConfigurations: ActivityRecord not found for: Token{3d2091b null}
at android.os.Parcel.readException(Parcel.java:1708)
at android.os.Parcel.readException(Parcel.java:1654)
at android.app.ActivityManagerProxy.reportSizeConfigurations(ActivityManagerNative.java:8401)
at android.app.ActivityThread.reportSizeConfigurations(ActivityThread.java:3125)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3068)
at android.app.ActivityThread.-wrap14(ActivityThread.java:-1)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6816)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:14
51)

Ex7:
android.support.v4.app.SuperNotCalledException: Fragment FragmentContainer{a73d66e #1 id=0x11} did not call through to super.onResume()
at android.support.v4.app.Fragment.performResume(Fragment.java:2403)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1465)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Ex8:
Xamarin Exception Stack:
Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <26daccb04dc641819234102c21fb48e0>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <26daccb04dc641819234102c21fb48e0>:0
at Android.Views.View.Draw (Android.Graphics.Canvas canvas) [0x00031] in :0
at Xamarin.Forms.Platform.Android.ScrollViewRenderer.Draw (Android.Graphics.Canvas canvas) [0x0000d] in <173f39d71f0d4d928f5bbea42e96ffa8>:0
at Android.Views.View.n_Draw_Landroid_graphics_Canvas_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_canvas) [0x0000f] in :0
at (wrapper dynamic-method) System.Object:89e10ba0-7d74-443b-8d59-0e936efe0c75 (intptr,intptr,intptr)
at java.lang.StackOverflowError
at android.text.Layout.draw(Layout.java:213)
at android.text.BoringLayout.draw(BoringLayout.java:400)
at android.widget.TextView.onDraw(TextView.java:5780)
at android.view.View.draw(View.java:14636)
at android.view.View.getDisplayList(View.java:13568)
at android.view.View.getDisplayList(View.java:13612)
at android.view.View.draw(View.java:14349)
at android.view.ViewGroup.drawChild(ViewGroup.java:3155)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3031)
at android.view.View.getDisplayList(View.java:13566)
at android.view.View.getDisplayList(View.java:13612)
at android.view.View.draw(View.java:14349)

Ex9:
java.lang.IllegalArgumentException: reportSizeConfigurations: ActivityRecord not found for: Token{63ff12e ActivityRecord{45507a9 u0 com.higgx.studying/md5f86dd3651b84190e5d2506587b29c5c3.MainActivity t2465 f}}
at android.os.Parcel.readException(Parcel.java:1687)
at android.os.Parcel.readException(Parcel.java:1636)
at android.app.ActivityManagerProxy.reportSizeConfigurations(ActivityManagerNative.java:6946)
at android.app.ActivityThread.reportSizeConfigurations(ActivityThread.java:2850)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2793)
at android.app.ActivityThread.-wrap12(ActivityThread.java:-1)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Getting control after INavigation.PopAsync() in Xamarin Forms

$
0
0

I have PageA + ViewModelA, and PageB + ViewModelB.

From A i'm calling PushAsync(B), editing some data, and calling PopAsync().

So now B becomes closed, and user returns to A.

But in B user changed some state, that should be update on A. What is the correct way to notify A to update state (and it would be better to have access to ViewModelB).

How to handle intermittent crashes unrelated to our code in a Xamarin Forms application?

$
0
0

I have an application published on Google Play built using Xamarin Forms. I use the MS App Center to monitor crashes and daily I receive crash information from code unrelated to my application. How us must handle this cases?

Is there any way to better investigate these cases? Should I register a bug for each of them?

Ex1:
java.lang.OutOfMemoryError: Failed to allocate a 20 byte allocation with 0 free bytes and 3GB until OOM
at kh.a(com.google.android.gms.DynamiteModulesB@12221238@12.2.21 (238-188803320):95)
at kh.b(com.google.android.gms.DynamiteModulesB@12221238@12.2.21 (238-188803320):90)
at com.google.maps.api.android.lib6.impl.fn.a(com.google.android.gms.DynamiteModulesB@12221238@12.2.21 (238-188803320):11)
at com.google.maps.api.android.lib6.impl.fp.run(com.google.android.gms.DynamiteModulesB@12221238@12.2.21 (238-188803320):23)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

Ex2:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.higgx.studying/md5f86dd3651b84190e5d2506587b29c5c3.MainActivity}: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.AbsListView$SavedState
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2706)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.-wrap12(ActivityThread.java:-1)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1514)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6205)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
....

Ex3:
Xamarin Exception Stack:
System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer from native handle 0xffc1382c (key_handle 0x3d153b).
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in :0
at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in :0
at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in :0
at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in :0
at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in :0
at Android.Views.View.n_Invalidate (System.IntPtr jnienv, System.IntPtr native__this) [0x00000] in :0
at (wrapper dynamic-method) System.Object:a8fd650e-905c-49b3-9edc-1805d8c4a198 (intptr,intptr)
--- End of inner exception stack trace ---
...

Ex4:
java.util.concurrent.TimeoutException: android.view.ThreadedRenderer.finalize() timed out after 10 seconds
at android.view.ThreadedRenderer.nDeleteProxy(ThreadedRenderer.java:-2)
at android.view.ThreadedRenderer.finalize(ThreadedRenderer.java:896)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:222)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:209)
at java.lang.Thread.run(Thread.java:761)

Ex5:
Xamarin Exception Stack:
Java.Lang.Error: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <26daccb04dc641819234102c21fb48e0>:0
at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in <26daccb04dc641819234102c21fb48e0>:0
at Android.Graphics.BitmapFactory.DecodeResource (Android.Content.Res.Resources res, System.Int32 id) [0x00044] in :0
at Android.Graphics.BitmapFactory+<>c__DisplayClass25_0.b__0 () [0x00000] in :0
at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x0000f] in <d361b61194ad4e55becd53788466b04c>:0 at System.Threading.Tasks.Task.Execute () [0x00010] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d361b61194ad4e55becd53788466b04c>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at Xamarin.Forms.Platform.Android.FileImageSourceHandler+d__4.MoveNext () [0x00144] in <173f39d71f0d4d928f5bbea42e96ffa8>:0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <26daccb04dc641819234102c21fb48e0>:0
at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in <26daccb04dc641819234102c21fb48e0>:0
at Android.Graphics.BitmapFactory.DecodeResource (Android.Content.Res.Resources res, System.Int32 id) [0x00044] in :0
at Android.Graphics.BitmapFactory+<>c__DisplayClass25_0.b__0 () [0x00000] in :0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in :0
at System.Threading.Tasks.Task.Execute () [0x00010] in :0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0

Ex6:
java.lang.IllegalArgumentException: reportSizeConfigurations: ActivityRecord not found for: Token{3d2091b null}
at android.os.Parcel.readException(Parcel.java:1708)
at android.os.Parcel.readException(Parcel.java:1654)
at android.app.ActivityManagerProxy.reportSizeConfigurations(ActivityManagerNative.java:8401)
at android.app.ActivityThread.reportSizeConfigurations(ActivityThread.java:3125)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3068)
at android.app.ActivityThread.-wrap14(ActivityThread.java:-1)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6816)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:14
51)

Ex7:
android.support.v4.app.SuperNotCalledException: Fragment FragmentContainer{a73d66e #1 id=0x11} did not call through to super.onResume()
at android.support.v4.app.Fragment.performResume(Fragment.java:2403)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1465)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Ex8:
Xamarin Exception Stack:
Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <26daccb04dc641819234102c21fb48e0>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <26daccb04dc641819234102c21fb48e0>:0
at Android.Views.View.Draw (Android.Graphics.Canvas canvas) [0x00031] in :0
at Xamarin.Forms.Platform.Android.ScrollViewRenderer.Draw (Android.Graphics.Canvas canvas) [0x0000d] in <173f39d71f0d4d928f5bbea42e96ffa8>:0
at Android.Views.View.n_Draw_Landroid_graphics_Canvas_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_canvas) [0x0000f] in :0
at (wrapper dynamic-method) System.Object:89e10ba0-7d74-443b-8d59-0e936efe0c75 (intptr,intptr,intptr)
at java.lang.StackOverflowError
at android.text.Layout.draw(Layout.java:213)
at android.text.BoringLayout.draw(BoringLayout.java:400)
at android.widget.TextView.onDraw(TextView.java:5780)
at android.view.View.draw(View.java:14636)
at android.view.View.getDisplayList(View.java:13568)
at android.view.View.getDisplayList(View.java:13612)
at android.view.View.draw(View.java:14349)
at android.view.ViewGroup.drawChild(ViewGroup.java:3155)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3031)
at android.view.View.getDisplayList(View.java:13566)
at android.view.View.getDisplayList(View.java:13612)
at android.view.View.draw(View.java:14349)

Ex9:
java.lang.IllegalArgumentException: reportSizeConfigurations: ActivityRecord not found for: Token{63ff12e ActivityRecord{45507a9 u0 com.higgx.studying/md5f86dd3651b84190e5d2506587b29c5c3.MainActivity t2465 f}}
at android.os.Parcel.readException(Parcel.java:1687)
at android.os.Parcel.readException(Parcel.java:1636)
at android.app.ActivityManagerProxy.reportSizeConfigurations(ActivityManagerNative.java:6946)
at android.app.ActivityThread.reportSizeConfigurations(ActivityThread.java:2850)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2793)
at android.app.ActivityThread.-wrap12(ActivityThread.java:-1)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Problems with StackLayout width and text being character broken

$
0
0

I am trying to make an info pane with an image on the left side and the remainder being a title text with a status button in the top right:

The problem that you can see there is that the button is forced onto two lines and I have not for the life of me been able to stop that from happening.

This is my xaml as I have it now:

<StackLayout Orientation="Horizontal">
                <Image Source="jamespaulprofileicon.jpg" HeightRequest="70" WidthRequest="70" Margin="10,15,10,0" HorizontalOptions="Start" VerticalOptions="Start"/>

                <StackLayout HorizontalOptions="StartAndExpand" VerticalOptions="FillAndExpand" Orientation="Vertical">
                    <StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand" BackgroundColor="Red">
                        <Label Text="This is a test title with a normal amount of text " Font="17" TextColor="Black" HorizontalOptions="Start" Margin="0" BackgroundColor="Yellow" />
                        <Frame BackgroundColor="Green" CornerRadius="14" Padding="0,0,0,0" Margin="0,0,0,0" HorizontalOptions="EndAndExpand" VerticalOptions="Start" HasShadow="False">
                            <Label Text="Pending" Font="12" TextColor="White"  HorizontalOptions="FillAndExpand" Margin="0,0,0,0"/>
                        </Frame>
                    </StackLayout>
                </StackLayout>
            </StackLayout>
            <BoxView Margin="10,0,10,0" HeightRequest="2" WidthRequest="1700" VerticalOptions="Start" HorizontalOptions="StartAndExpand" BackgroundColor="#10A220" />

I have my frame and text of the status set to expand, with the title text set not to do this. I've tried every horizontal option but I cannot get it to keep the text on the expanding container/label on one line. The only way I can achieve this is to reduce the length of the title but that is useless since I'll be dealing with longer titles.

Why are the horizontal options bot being respected in my code here? Why is it that the first label set only to Start is the one that expands and pushes the second container to be character-wrapped? I have also tried changing the lineBreakMode but that doesn't change the way it's drawn and so the end of the text is clipped.

I do not want to manually set the width of the status button since this layout will be used for a second shell which will be placing a price there and the length of that could be $1 or much higher, it needs to expand to meet the length of the content I put in there.

Any help would be appreciated here, I feel like I'm going mad trying to figure out why none of this will work.

Ios Renderer wrong children frame

$
0
0

Hi, I'm trying to create a popover implementation in my xamarin forms app. I want to be able to show a xamarin forms' view in an iOS Popover but I'm not able to render my view correctly.

Here's my Xamarin Forms code :

var content = new ContentView
{
    BackgroundColor = Color.Coral,
    WidthRequest = 300,
    HeightRequest = 60,
    Content = new Label
    {
        Text = "Text in Popover",
        TextColor = Color.Black,
        VerticalOptions = LayoutOptions.CenterAndExpand,
        HorizontalOptions = LayoutOptions.CenterAndExpand,
        BackgroundColor = Color.Yellow
    }
};
PopoverManager.ShowPopover(this, content, (Button)sender);

And this is iOS Part :

        public void ShowPopover(Page page, VisualElement content, VisualElement origine)
        {
            var viewController = Platform.GetRenderer(page).ViewController;
            var viewOrigine = Platform.GetRenderer(origine).NativeView;

            var rect = viewController.View.ConvertRectFromView(viewOrigine.Frame, viewOrigine.Superview);

            UIViewController popoverVc = new UIViewController
            {
                ModalPresentationStyle = UIModalPresentationStyle.Popover
            };

            popoverVc.View = GetUIView(content);
            popoverVc.PopoverPresentationController.SourceView = viewController.View;
            popoverVc.PopoverPresentationController.SourceRect = rect;
            popoverVc.PreferredContentSize = popoverVc.View.Frame.Size;
            popoverVc.PopoverPresentationController.BackgroundColor = popoverVc.View.BackgroundColor;

            viewController.PresentViewController(popoverVc, true, null);
        }

        public static UIView GetUIView(VisualElement view)
        {

            if (Platform.GetRenderer(view) == null)
                Platform.SetRenderer(view, Platform.CreateRenderer(view));

            var vRenderer = Platform.GetRenderer(view);

            var minSize = vRenderer.Element.Measure(double.PositiveInfinity, double.PositiveInfinity, MeasureFlags.IncludeMargins);
            var rect = new Rectangle(Point.Zero, minSize.Request);

            CGRect size = rect.ToRectangleF();

            vRenderer.NativeView.Frame = size;

            vRenderer.NativeView.TranslatesAutoresizingMaskIntoConstraints = true;
            vRenderer.NativeView.AutoresizingMask = UIViewAutoresizing.All;
            vRenderer.NativeView.ContentMode = UIViewContentMode.ScaleToFill;

            vRenderer.Element?.Layout(size.ToRectangle());

            var nativeView = vRenderer.NativeView;

            nativeView.SetNeedsLayout();
            nativeView.SetNeedsDisplay();

            return nativeView;
        }

Popover presentation works fine and show the contentView with the right size but my Label have a frame equal to 0.

I think I'm missing something to render correctly all children.
My goal is to have more complexe views in popover and I don't want to manually setup size of each children.

Best regards

Viewing all 77050 articles
Browse latest View live


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