Getting a Force Close in Mpcharts for Onchartvalueselectedlist in android

By Sam

i’ve implemented OnchartValueSelectedlistener for Bar Charts in MpChart Android Library,but whenever i click on something which has no value,it force closes as Null Object Reference,is there any workaround for this?

Here’s my code

barChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
                @Override
                public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {
                    if (e != null)
                        get_month_data(e);
                }
                @Override
                public void onNothingSelected() {
                }
            });

I’m trying to do something with the entry,but since even null objects are getting passed,i’m getting a “trying to implement .toString on a Null Object reference” i guess,any inputs would be appreciated

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273