Telerik Forums
UI for Xamarin Forum
0 answers
233 views

Hi,

We are sometimes getting the following crash on Android after the user has closed a RadPopup. It does not happen every time so it looks like it is a timing issue. We have gotten the latest Telerik release and it is still happening in that version.

Below is the stack trace.

Regards

Anthony

System.ObjectDisposedException  Message=Cannot access a disposed object. Object name: 'Android.Widget.PopupWindow'.

0x29 in Java.Interop.JniPeerMembers.AssertSelf at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.cs:153,5
0x1 in Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:57,5
0x12 in Android.Widget.PopupWindow.Dismiss at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-29/mcw/Android.Widget.PopupWindow.cs:1635,5
0xD in Telerik.XamarinForms.Primitives.RadPopup.DismissPopupWindow
0x12 in Telerik.XamarinForms.Primitives.RadPopup.SetPopupIsOpen
0x3A in Telerik.XamarinForms.Primitives.RadPopup.UpdatePopup
0x36 in Telerik.XamarinForms.Primitives.PopupBase.Animation_ProgressChanged
0x12 in Telerik.XamarinForms.Common.RadDoubleAnimation.OnProgressChanged
0x2C in Telerik.XamarinForms.Common.RadDoubleAnimation.OnAnimationTick
0x3 in Telerik.XamarinForms.Common.RadAnimation.Telerik.XamarinForms.Common.Animations.IDoubleAnimationListener.OnAnimationTick
0x42 in Telerik.XamarinForms.Common.Animations.AnimationTask.NotifyTick
0x53 in Telerik.XamarinForms.Common.Animations.AnimationTask.Tick
0x1B in Telerik.XamarinForms.Common.Animations.AnimationManager.HandleAnimationsTick
0x0 in Telerik.XamarinForms.Common.Animations.AnimationManager.TickAnimations
0x0 in Telerik.XamarinForms.Common.Animations.AnimationManager.TickAnimationsFunc
0x6 in Xamarin.Forms.Forms.AndroidPlatformServices. at D:\a\1\s\Xamarin.Forms.Platform.Android\Forms.cs:893,6
0xE in Java.Lang.Thread.RunnableImplementor.Run at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36,6
0x8 in Java.Lang.IRunnableInvoker.n_Run at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-29/mcw/Java.Lang.IRunnable.cs:84,4
0x8 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:22,5

Anthony
Top achievements
Rank 1
Veteran
 asked on 09 Nov 2022
1 answer
53 views

<telerikPrimitives:RadPopup.Popup>
                <telerikPrimitives:RadPopup x:Name="popuptwo" IsModal="True" Placement="Center">
                    <telerikPrimitives:RadBorder WidthRequest="250" HorizontalOptions="Center" VerticalOptions="Center" CornerRadius="8" BackgroundColor="White">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="42"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50*"></ColumnDefinition>
                                <ColumnDefinition Width="50*"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid Grid.Row="0" Grid.ColumnSpan="2">
                                <telerikInput:RadButton ContentLayout="Left,4" x:Name="images" HorizontalOptions="Start"
                                    BorderColor="#c9c9c9" BackgroundColor="#4295F4" TextColor="White" BorderWidth="1" CornerRadius="8"  WidthRequest="400" VerticalOptions="Center"/>
                            </Grid>
                        </Grid>
                    </telerikPrimitives:RadBorder>
                </telerikPrimitives:RadPopup>
            </telerikPrimitives:RadPopup.Popup>

Didi
Telerik team
 answered on 29 Apr 2022
1 answer
184 views
Hi, please can you help me to find a solution, when I want to use SVG files on the  RadPopup!!!
Lance | Manager Technical Support
Telerik team
 answered on 02 Mar 2022
1 answer
443 views

Is it possible to have more than one RadPopup on a page? When I try to add a second popup I get an "The property 'Popup' is set more than once." error when trying to build.

 

telerikPrimitives:RadPopup.Popup

 

<!-- Loading Overlay -->
<telerikPrimitives:RadPopup.Popup>
    <telerikPrimitives:RadPopup x:Name="loadingPopup" IsOpen="{Binding IsBusy}" IsModal="True" OutsideBackgroundColor="#6FFFFFFF" Placement="Center">
        <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
            <ActivityIndicator IsRunning="true" />
        </StackLayout>
    </telerikPrimitives:RadPopup>
</telerikPrimitives:RadPopup.Popup>
 
<!-- New Log Entry Overlay -->
<telerikPrimitives:RadPopup.Popup>
    <telerikPrimitives:RadPopup x:Name="newLogEntryPopup" IsOpen="{Binding ShowNewLogEntryPopup}" IsModal="True" OutsideBackgroundColor="#6FFFFFFF" Placement="Center">
        <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
            <Frame BackgroundColor="White" HasShadow="True">
                <Label TextColor="{StaticResource NavigationPrimary}" FontSize="20" Margin="0,0,0,15" >Enter New Reading</Label>
            </Frame>
        </StackLayout>
    </telerikPrimitives:RadPopup>
</telerikPrimitives:RadPopup.Popup>
Alex
Telerik team
 answered on 12 Apr 2021
3 answers
572 views

Hi,

I use local notifications in my application. I want to open my background application from notification and show the message in popup window. That gives me exeption:

Android.Views.WindowManagerBadTokenException: 'Unable to add window -- token null is not valid; is your activity running?'

I think it is duo to timing but I doesn't know how to fix it.

 

//open popup after notification tapped

private static void ShowNotification(string title, string message)
        {
            App.isBackground = false;
            Device.BeginInvokeOnMainThread(() =>
            {
                TelerikPopupWin.SetLabelText = title +"\n"+ message;
                TelerikPopupWin.OpenPopup = true;
            });
        }

 

Error happens here:

public static bool OpenPopup { get { return popup.IsOpen; } set { popup.IsOpen = value; } }

 

 

Yana
Telerik team
 answered on 22 Feb 2021
3 answers
114 views
I've noticed that when creating a popup directly from code, you don't need to set PlacementTarget. Somehow the code internally solve this and use the entire window as placement.

I'm wondering if I can instantiate several new dialogs on demand or do I have to reuse the same instance everytime? Example: displaying alerts everytime I need.

My concerns are about the lifecycle, whether the garbage collector destroy them after closing or the instances keep living forever inside the page or somewhere.
Yana
Telerik team
 answered on 16 Jun 2020
5 answers
691 views

Hi,

I am popping up a modal message that I want the user to acknowledge by pressing on a close button inside the popup.

If they accidently press the back button on the device the modal popup is closed.

Is there any way to stop this from happening?

Thanks

Anthony

Yana
Telerik team
 answered on 30 Apr 2020
4 answers
416 views

Hi,

 

I noticed that when i set the placement of the popup it displays in the bottom right of the screen on android.

When i set it to relative it fills the screen.

Code for below:

<telerikPrimitives:RadPopup.Popup>
        <telerikPrimitives:RadPopup
            AnimationType="Zoom"
            IsModal="True"
            IsOpen="{Binding ShowUserActions}"
            OutsideBackgroundColor="#6F000000"
            Placement="Center">

            <Grid
                Padding="30"
                BackgroundColor="White"
                HorizontalOptions="Center"
                VerticalOptions="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                ....... content
            </Grid>

        </telerikPrimitives:RadPopup>
    </telerikPrimitives:RadPopup.Popup>

Didi
Telerik team
 answered on 24 Feb 2020
3 answers
106 views

Hello,

When I try to open a popup in uwp (Tried on local machine - windows 10) it throws the following exception : 

System.ArgumentException: 'Value does not fall within the expected range.'

 

The command I used: 

continuePopup.IsOpen = true;

Didi
Telerik team
 answered on 27 Jan 2020
2 answers
202 views

Hello,

I'm able to successfully set up a Xamarin Forms popup from the sample code here.  If I add this to a single Xaml page, I'm able to get the popup to open/close from the code-behind.
However I'm going to be using this in multiple areas of my application and wanted to see if it's possible to run this through a service.  To be specific, I want to use this to act like a busy indicator, to display an animated icon while data is loading, then close when done.  I'm trying to replicate this same type of functionality we're already using with another popup Rg.Plugins.Popup.  The difference with Telerik's version is that I want to see if I can avoid having to put the popup Xaml on every one of my pages.

 

Here's a service we're currently using.

01.public class PopupService : IPopupService
02.{
03.    private LoadingPopup indicatorPopup;   
04.
05.    //Get a new instance of the page that contains the popup Xaml
06.    public LoadingPopup IndicatorPopup { get { return indicatorPopup ?? (indicatorPopup = new LoadingPopup()); } }
07.    
08.    public async Task ShowIndicatorAsync()
09.    {
10.        Device.BeginInvokeOnMainThread(async () =>
11.        {
12.            //Open the popup from that page
13.            await PopupNavigation.Instance.PushAsync(IndicatorPopup, false);
14.        });
15.    }
16. 
17.    public async Task DismissIndicatorAsync()
18.    {
19.        Device.BeginInvokeOnMainThread(async () =>
20.        {
21.            //Close the popup from that page
22.            await PopupNavigation.Instance.RemovePageAsync(IndicatorPopup, false);
23.        });
24.    }
25.}

 

The popups are called in the ViewModels by using the service like this.

01.public class SamplePageViewModel : BaseViewModel
02.{
03.    private readonly IFinancialDataService _financialDataService;
04. 
05.    public SamplePageViewModel (IFinancialDataService financialDataService, IPopupService popupService) : base(popupService)
06.    {
07.        _financialDataService = financialDataService;
08.    }
09. 
10.    public async Task Init()
11.    {
12.        try
13.        {
14.            //Show popup here
15.            await PopupService.ShowIndicatorAsync();
 16
17.            var data = await _financialDataService.GetData();          
18.            ...
19.        }
20.        catch (Exception e)
21.        {
22.            ...
23.        }
24.        finally
25.        {
26.           //Close popup here
27.           await PopupService.DismissIndicatorAsync();
28.        }
29.    }
30.}

 

 

So what I'm trying to do is put the Telerik popup Xaml in a Content Page and call it through the service instead. 

I can add public methods to the code-behind of that page like this.

01.public void ShowPopup()
02.{
03.    popup.IsOpen = true;
04.}
05. 
06.public void ClosePopup()
07.{
08.    popup.IsOpen = false;
09.}

 

Then I can call those methods from my same service like this instead.

01.public async Task ShowIndicatorAsync()
02.{
03.    Device.BeginInvokeOnMainThread(async () =>
04.    {
05.        //Now call the open method in the code-behind
06.        IndicatorPopup.ShowPopup();
07.    });
08.}
09. 
10.public async Task DismissIndicatorAsync()
11.{
12.    Device.BeginInvokeOnMainThread(async () =>
13.    {
14.        //Now call the close method in the code-behind
15.        IndicatorPopup.ClosePopup();
16.    });
17.}

 

When I do this, I can actually see the Telerik popup's semi-transparent background opening and closing, but can't see my indicator, or anything else I put inside the popup.  I can only see it if it's run on a single page.  Any suggestions on how to implement something similar with the Telerik popup?

Mark
Top achievements
Rank 1
 answered on 08 Oct 2019
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?