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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfAccordion Attempt to read from field 'int android.view.ViewGroup$LayoutParams.width' on a null object reference

Thread ID:

Created:

Updated:

Platform:

Replies:

149732 Dec 6,2019 05:22 PM UTC Dec 16,2019 05:36 AM UTC Xamarin.Forms 13
loading
Tags: SfAccordion
mohamed
Asked On December 6, 2019 05:22 PM UTC

Hello,

I am trying to use SfAccordion but i got error while filling the list with data 

Attempt to read from field 'int android.view.ViewGroup$LayoutParams.width' on a null object reference

<accrod:SfAccordion ExpandMode="SingleOrNone" BindableLayout.ItemsSource="{Binding ItemInfo}">
            <BindableLayout.ItemTemplate>
                <DataTemplate>
                    <accrod:AccordionItem>
                        <accrod:AccordionItem.Header>
                            <Label Text="{Binding ItemName}"/>
                        </accrod:AccordionItem.Header>
                        <accrod:AccordionItem.Content>
                            <Label Text="{Binding ItemPrice}"/>
                        </accrod:AccordionItem.Content>
                    </accrod:AccordionItem>
                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </accrod:SfAccordion>

I need help , i don't know what i has done wrong and where is my mistake

Gnana Priya Namasivayam [Syncfusion]
Replied On December 9, 2019 12:36 PM UTC

Hi Mohamed, 
 
We have checked the reported query and issue gets reproduced but only in latest version of Xamarin Forms 4.3.0.991221. You can overcome the reported issue by loading inside the container like Grid. We have reported the issue to Xamarin Team, you can follow the below bug report for further follow up. 
 
 
Please find the sample with workaround for your reference from following link. 
 
 
 
<syncfusion:SfAccordion x:Name="Accordion" BindableLayout.ItemsSource="{Binding Info}"> 
        <BindableLayout.ItemTemplate> 
            <DataTemplate> 
                <syncfusion:AccordionItem> 
                    <syncfusion:AccordionItem.Header> 
                        <Grid> 
                            <Label Text="{Binding Name}"/> 
                        </Grid> 
                    </syncfusion:AccordionItem.Header> 
                    <syncfusion:AccordionItem.Content> 
                        <Grid> 
                            <Label Text="{Binding Description}"/> 
                        </Grid> 
                    </syncfusion:AccordionItem.Content> 
                </syncfusion:AccordionItem> 
            </DataTemplate> 
        </BindableLayout.ItemTemplate> 
</syncfusion:SfAccordion> 
 
 
Please let us know if you need any further assistance form our side. 
 
Regards, 
Gnana Priya N 


mohamed
Replied On December 9, 2019 05:59 PM UTC

hello again , 

Thanks for the replying, 

1st: i have a problem to use latest version of Xamarin Forms 4.3.0.991221 coz i got error after installing it can i use  version 4.3.0.991211 instead ?

2nd : is there is event for the sfAccordion Like (OnExpanding - OnExpanded - OnCollapsed - ..... etc ) or i have no control on the headerGroup ?

3rd: i did a trick to make 4.3.0.991221 work with me i changed Xamarin.Forms.Platform.iOS.dll to the preveos version of 4.3.0.991211 so the application worked and the SfAccordion appears in IOS only and not appearing at all in andriod . and in IOS the list is not clickable or expanbale 



Thanks.

Gnana Priya Namasivayam [Syncfusion]
Replied On December 10, 2019 10:35 AM UTC

Hi Mohamed, 
 
Please find the following details for the reported query, 

Query1 :  
Yes. You can use Xamarin forms version 4.3.0.991211. 
 
Query 2 : 
In Accordion, you can use Expanded, Expanding, Collapsed & Collapsing events. You can customize accordion view based on your requirements using these events. 

Query 3: 
We suggest you to use Xamarin version 4.3.0.991211 which works fine in all three platforms. Kindly stick to this version until the reported issue fixes in Xamarin forms.  
 
Please let us know if you have any further queries regarding listview. 
 
Regards, 
Gnana Priya N 


mohamed
Replied On December 10, 2019 05:57 PM UTC

Hello,

1st : I downgraded the Xamarin.Forms to 4.3.0.991211 and the application works fine without errors in IOS and Andriod.

2nd: I Updated all Syncfusion controls to the latest releases today Version: 17.3.0.34.

3rd:  In IOS Device (Iphone7) and Andriod the SfAccordion Appears after setting the row height of the grid container
                                   
                                       
                                   



mohamed
Replied On December 10, 2019 06:09 PM UTC

Hello,

I fixed my problem for IOS & Andriod After setting Grid row height every thing worked as expected but The RTL (Flow direction) didn't work with IOS and it works for Android fine, is there is anyway to Make RTL works for IOS ?

Solution for appearing in IOS & Andriod and make the Expandable event works:
                                   <Grid.RowDefinitions>
                                        <RowDefinition Height="400" />
                                    </Grid.RowDefinitions>


mohamed
Replied On December 11, 2019 09:36 AM UTC

Hello,

I just figure out that the HeaderIconPosition in IOS is not appears correctly when i set it to End it shows in Start and when i set it to End it Shows at Start this for IOS Only , Android works Fine.

so that what i did to solve this in RTL:

if (CrossMultilingual.Current.CurrentCultureInfo.EnglishName == "Arabic")
            {

                this.FlowDirection = FlowDirection.RightToLeft;
                if (Device.RuntimePlatform == Device.iOS)
                {
                    Accordion.HeaderIconPosition = Syncfusion.XForms.Expander.IconPosition.Start;      //  <---- this will show it at the End ( is it a bug ??)
                }
                else if (Device.RuntimePlatform == Device.Android)
                {
                    Accordion.HeaderIconPosition = Syncfusion.XForms.Expander.IconPosition.End;
                }
                
            }

Subburaj Pandian Veluchamy [Syncfusion]
Replied On December 11, 2019 12:35 PM UTC

Hi Mohamed, 
 
Thank you for the update.

Regarding Label positing in RTL: We have checked the issue with the sample, as default all the Accordion elements loading property in RTL mode. When handling Label position, there is a known framework issue there in RTL mode.

Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/AccordionSample-844239292.zip

Also, check the attached sample as we loaded with lower Xamarin.Forms version and confirm your Xamarin.Forms update version, it will be helpful for us to proceed further?

Regards,
Subburaj Pandian V 


mohamed
Replied On December 11, 2019 12:47 PM UTC

Hello,

Thanks for your support and sample. and i am still using Xamarin.Forms 4.3.0.991211.

i am just waiting for how to collapse item from code behind but i posted in another thread thanks.

Gnana Priya Namasivayam [Syncfusion]
Replied On December 12, 2019 10:45 AM UTC

Hi  Mohammed, 
 
We would like to inform that when RTL is defined to Accordion, HeaderIcon positions as expected in both Android and iOS. Meantime, please confirm us whether you have added the RightToLeft language in the CFBundleLocalizations section of your Info.plist file like below. 
 
 
<resources> 
        <key>CFBundleDevelopmentRegion</key> 
               <string>en</string> 
        <key>CFBundleLocalizations</key> 
        <array> 
                <string>en</string> 
                <string>ar</string> 
        </array> 
</resources> 
 
 
We have attached the screenshot for your reference, kindly find them below following link. 
 
 
If the reported issue still replicates then revert us back with the issue replicated or modified sample so that we could validate and provide you appropriate solution at our end. 
 
Regards, 
Gnana Priya N 


mohamed
Replied On December 12, 2019 11:49 AM UTC

Hello,

I tried to edit the info.plist like u mentioned but it didnt change anything, i don't know what i am missing

this is my info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

<dict>
  <key>CFBundleDevelopmentRegion</key>
  <string>en</string>
  <key>CFBundleLocalizations</key>
  <array>
    <string>en</string>
    <string>ar</string>
  </array>


  <key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIAppFonts</key>
<array>
<string>UIFontIcons.ttf</string>
<string>Montserrat-Bold.ttf</string>
<string>Montserrat-Medium.ttf</string>
<string>Montserrat-Regular.ttf</string>
<string>Montserrat-SemiBold.ttf</string>
</array>
<key>MinimumOSVersion</key>
<string>8.0</string>
<key>CFBundleDisplayName</key>
<string>MLKApp</string>
<key>CFBundleIdentifier</key>
<string>com.Moci.MociApp</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleName</key>
<string>MLKApp</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
</dict>
</plist>


Gnana Priya Namasivayam [Syncfusion]
Replied On December 13, 2019 12:39 PM UTC

Hi Mohammed, 
 
 
We would like to inform that reported issue does not occur in our side. Can you please confirm us whether reported issue occur in framework also? If possible share issue replicated sample or modified sample in order to check the reported issue in your sample. If you face any difficulties in replicating in the provided sample, we can setup web-meeting to avoid further delay. Kindly confirm your availability for the web meeting so that we can investigate and provide you the solution at the earliest.   
 
 
Regards, 
Gnana Priya N 


mohamed
Replied On December 13, 2019 09:57 PM UTC

Thanks for the reply but my problem sovled by this code , i just invert IconPosition.Start IconPosition.End in IOS and it works well, and for Android nothing needs to change it works well. Thanks

if (CrossMultilingual.Current.CurrentCultureInfo.EnglishName == "Arabic")
            {

                this.FlowDirection = FlowDirection.RightToLeft;
                if (Device.RuntimePlatform == Device.iOS)
                {
                    Accordion.HeaderIconPosition = Syncfusion.XForms.Expander.IconPosition.Start;      
                }
                else if (Device.RuntimePlatform == Device.Android)
                {
                    Accordion.HeaderIconPosition = Syncfusion.XForms.Expander.IconPosition.End;
                }
                
            }


Gnana Priya Namasivayam [Syncfusion]
Replied On December 16, 2019 05:36 AM UTC

Hi Mohammed, 
 
Thanks for the update. 
 
We are glad that reported issue have been fixed in your application. Please let us know if you need any further assistance from us. 
 
Regards, 
Gnana Priya N 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon