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
<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>
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
>
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; } }
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
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>
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;
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();
1617.
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?