Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Error Inflating Class Fragment when changing fragments with Shinobicharts in Xamarin

$
0
0

I have read different articles about this kind of error in SO. Most of them relate to Google Map and one is about Shinobicharts, but it didn't fix the error in my app.
I am using Xamarin.Android and have implemented Shinobicharts. The chart is in a fragment and the XML code looks like that:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="500dp"
android:id="@+id/linearLayout2"
android:background="#ffffffff">
<LinearLayout
    android:orientation="vertical"
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/linearLayout1">
    <TableLayout
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tableLayout1"
        android:stretchColumns="0,1">
        <TableRow
            android:minWidth="25px"
            android:minHeight="25px"
            android:id="@+id/tableRow1">
            <RelativeLayout
                android:minWidth="25px"
                android:minHeight="25px"
                android:id="@+id/relativeLayout1">
                <ImageButton
                    android:src="@drawable/ic_action_refresh_default"
                    android:layout_width="48dp"
                    android:layout_height="48dp"
                    android:id="@+id/imageButton1"
                    android:layout_alignParentRight="true"
                    android:background="#ffffffff" />
            </RelativeLayout>
        </TableRow>
    </TableLayout>
</LinearLayout>
<fragment
    class="com.shinobicontrols.charts.ChartFragment"
    android:id="@+id/chart"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
</LinearLayout>

My fragment is inheriting the Fragment class and not the activity:

    public class AnsprechpartnerFragment : Fragment

When I run the app and the fragment is loaded the first time, it works fine. But when I change the fragment and return back to the fragment containing the Shinobicharts, I get the following error:
Binary XML file line #1: Error inflating class fragment
The error raises in the following line:

public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        if (layoutId == null || layoutId == 0)
            layoutId = UI.Resource.Layout.ChartFragment;
        var view = inflater.Inflate (layoutId, container, false);
        return view;
    }

I tried it on Genymotion with API 17 and on a real Nexus 10 device with Android 4.4, but I get the same error again. I check the manifest file and tried the following versions, but none of them fixed the error:

<?xml version="1.0" encoding="Windows-1252"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.shinobicontrols.charts.samples.annotations">
<uses-sdk android:minSdkVersion="17" />
<application android:label="Annotations" android:hardwareAccelerated="true"></application>
</manifest>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="dk.ostebaronen.drawersample" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="8" />
<application android:label="Drawer Sample"></application>
</manifest>

Can anybody help me? I googled a lot and couldn't find anything solving this issue.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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