We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Java.Lang.StackOverflowError

Hello,
what I want to achieve is a bit complex but I always get the exception in the subject.
My goal is to create a page having a SfPopupLayout, a SfNavigationDrawer and a SfListView nested in another SfListView. If I create the page piece by piece, starting from the nested SfListView, I can compile and view the result until I put the last step, despite what this step is: SfListView + SfListView + SfNavigationDrawer works, SfListView + SfListView + SfPopupLayout works, SfListView + SfListView + SfNavigationDrawer + SfPopupLayout doesn't work, SfListView + SfListView + SfPopupLayout + SfNavigationDrawer doesn't work.

The listviews read data from a SQLite database and everything is binded in MVVM pattern.

Here's the relevant part of my code:

<sfPopup:SfPopupLayout x:Name="popUpLayout" HorizontalOptions="FillAndExpand" IsOpen="{Binding IsOpenAlert, Mode=TwoWay}" VerticalOptions="FillAndExpand">
<sfPopup:SfPopupLayout.Content HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<navigationdrawer:SfNavigationDrawer x:Name="navigationDrawer" BackgroundColor="{StaticResource AppBackgroundColor}" DrawerHeaderHeight="200" DrawerWidth="300" HorizontalOptions="FillAndExpand" IsOpen="{Binding IsOpen, Mode=TwoWay}" VerticalOptions="FillAndExpand">
<navigationdrawer:SfNavigationDrawer.DrawerHeaderView>...</navigationdrawer:SfNavigationDrawer.DrawerHeaderView>
<navigationdrawer:SfNavigationDrawer.DrawerContentView>...</navigationdrawer:SfNavigationDrawer.DrawerContentView>
<navigationdrawer:SfNavigationDrawer.ContentView>
<Grid BackgroundColor="{StaticResource AppBackgroundColor}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackLayout Margin="0" Padding="0" HorizontalOptions="FillAndExpand" Orientation="Horizontal" VerticalOptions="FillAndExpand">
<Button />
<Label />
</StackLayout>
<StackLayout Grid.Column="1" Margin="0" Padding="0" HorizontalOptions="FillAndExpand" Orientation="Horizontal" VerticalOptions="FillAndExpand">
<Button />
<Button />
<Button />
</StackLayout>
<listView:SfListView x:Name="listView" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,20,0,0" AutoFitMode="Height" ItemsSource="{Binding ListaStati}" Loaded="ListView_Loaded">
<listView:SfListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid Margin="0,0,0,15">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackLayout Margin="0" Padding="20,0,0,0" HorizontalOptions="FillAndExpand" Orientation="Horizontal" VerticalOptions="FillAndExpand">
<Image Aspect="AspectFit" Source="{Binding Immagine}" VerticalOptions="CenterAndExpand" />
<Label Margin="10,0,0,0" FontAttributes="Bold" FontSize="Medium" Text="{Binding DescStato}" VerticalOptions="CenterAndExpand" VerticalTextAlignment="Center" />
</StackLayout>
<ctrl:ExtendedListView Grid.Row="1" AutoFitMode="Height" HeightRequest="{Binding InnerListHeight}" ItemSize="200" ItemsSource="{Binding Audits}" Orientation="Horizontal" SelectionMode="SingleDeselect">
<ctrl:ExtendedListView.ItemTemplate>
<DataTemplate>
<local:AuditViewTabletMode />
</DataTemplate>
</ctrl:ExtendedListView.ItemTemplate>
</ctrl:ExtendedListView>
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</listView:SfListView.ItemTemplate>
</listView:SfListView>
</Grid>
</navigationdrawer:SfNavigationDrawer.ContentView>
</navigationdrawer:SfNavigationDrawer>
</sfPopup:SfPopupLayout.Content>
<sfPopup:SfPopupLayout.PopupView>
<local:PopUpLogout AcceptButtonText="{i18n:Translate Text=ConfirmButtonText}" AcceptCommand="{Binding AcceptButtonCustomCommand}" DeclineButtonText="{i18n:Translate Text=CancelButtonText}" DeclineCommand="{Binding DeclineButtonCustomCommand}" />
</sfPopup:SfPopupLayout.PopupView>
</sfPopup:SfPopupLayout>

The ExtendedListView class is taken from one of your examples (here)

How can I achieve the result?

Thanks in advance,
Matteo


5 Replies

JN Jayaleshwari N Syncfusion Team December 7, 2018 09:30 AM UTC

Hi Matteo,  
  
Thanks for Contacting Syncfusion Support. 
    
We have checked the reported query “Java.Lang.StackOverflowError” from our side. We have prepared the sample based on the template given by you and checked the issue. Unfortunately, the reported crash does not replicate at our end. Listview is loaded in the view as expected.    
  
We have attached the tested sample for your reference and you can download the same from the below link.    
    
Can you please check the reported issue occurs in our sample also? If not, we would request you to modify our sample to replicate the issue which would highly help us to analyze the query better and provide an appropriate solution.     
  
Regards,  
Jayaleshwari N 



MC Matteo Comi December 11, 2018 11:27 AM UTC

I think I solved it, thanks.
I'm waiting for a physical Android device to arrive and I will test it there.


JN Jayaleshwari N Syncfusion Team December 12, 2018 07:13 AM UTC

Hi Matteo, 
 
Thanks for the update. 
We will wait to hear from you. 
 
Regards, 
Jayaleshwari N. 



FM filler mark December 9, 2019 04:40 AM UTC

A StackOverflowError is simply signals that there is no more memory available. It is to the stack what an OutOfMemoryError is to the heap: it simply signals that there is no more memory available. JVM has a given memory allocated for each stack of each thread, and if an attempt to call a method happens to fill this memory, JVM throws an error. Just like it would do if you were trying to write at index N of an array of length N. No memory corruption can happen. The stack can not write into the heap.

The common cause for a stackoverflow is a bad recursive call. Typically, this is caused when your recursive functions doesn't have the correct termination condition, so it ends up calling itself forever. Or when the termination condition is fine, it can be caused by requiring too many recursive calls before fulfilling it.

Here's an example:

public class Overflow {
    public static final void main(String[] args) {
        main(args);
    }

}
That function calls itself repeatedly with no termination condition. Consequently, the stack fills up because each call has to push a return address on the stack, but the return addresses are never popped off the stack because the function never returns, it just keeps calling itself.




GP Gnana Priya Namasivayam Syncfusion Team December 9, 2019 12:34 PM UTC

Hi Filler Mark, 
 
Can you please let us know whether you have shared the suggestion for Matteo or provided suggestion on our side. We are just confirming whether you need any help from our side regarding the reported issue in this forum. 
 
If any kindly let us know. We will happy to help you as always. 
 
Regards, 
Gnana Priya N 


Loader.
Up arrow icon