I am trying to load highcharts
via Dialog
. Below is my code
Gradle
implementation 'com.highsoft.highcharts:highcharts:9.0.1'
XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:padding="10dp">
<com.highsoft.highcharts.core.HIChartView
android:id="@+id/goly_gauge"
android:layout_width="match_parent"
android:layout_height = "350dp"
/>
<com.highsoft.highcharts.core.HIChartView
android:id="@+id/golm_gauge"
android:layout_width="match_parent"
android:layout_height="350dp"
/>
<Button
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="OK" />
</LinearLayout>
</ScrollView>
Fragment
suggestion_list.setOnItemClickListener((parent, view, position, id) -> {
String selectedFromList = (String) (suggestion_list.getItemAtPosition(position));
showPreFilledData(selectedFromList);
Log.e(TAG, arraylist.get(position));
});
private void showPreFilledData(String string) {
final Dialog dialog = new Dialog(getActivity());
dialog.setContentView(R.layout.product_sales_layout);// error comes at this point
dialog.setTitle("Product Sales");
Button ok;
ok = (Button) dialog.findViewById(R.id.ok);
switch (string) {
case "A2A 100 MG TABS":
GolYgauge(55.1);
GolMgauge(32.9);
break;
case "AQUA-VIT SACHET":
GolYgauge(45.8);
GolMgauge(22.7);
break;
case "BRONCOPHYLINE SYRUP":
GolYgauge(65.7);
GolMgauge(42.4);
break;
}
ok.setOnClickListener(v -> dialog.dismiss());
Window window = dialog.getWindow();
window.setLayout(LinearLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT);
dialog.show();
}
When I click on an item in my list view
I want to open a layout and want to display data inside a gauge. But I am getting error
android.view.InflateException: Binary XML file line #15 in com.thumbsol.accuratemobileassetsmanagament:layout/product_sales_layout: Binary XML file line #15 in com.thumbsol.accuratemobileassetsmanagament:layout/product_sales_layout: Error inflating class
The line number 15 is <com.highsoft.highcharts.core.HIChartView
. I am stuck to it. How can get rid from this issue?
Any help would be highly appreciated.