I've created a small app that uses the chart library MPAndroidChart to visualize the data it holds. I'm creating Charts, generating PDF holding the Charts, and so on, all initiated from the UI thread. Works fine so far.
Now there is a requirement to generate the Chart and PDF in a background thread on App startup (I'm trying AsyncTask but could use the different technique if required, the issue would be the same):
At the time I want to create the BarChart with
BarChart bc = new BarChart(p.context);
I get the mentioned exception:
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
I do not need any functionality to make the graphs/charts interactive ( I assume that the interactivity implemented in MPAndroidChart is the reason for the issues to use them outside of the UI thread).
Any idea of
- how to solve the problem with MPAndroidChart?
- alternate free Charting library that does not have the problem?
Any help would be great.
Thanks a lot!