0

I am getting a array from cursor, I want to pass the array to webview for display as chart. I don't have any experience in Json can you help.

For Conversion to Json

  @JavascriptInterface
      public JSONArray getNum11() {
                JSONArray myArray = new JSONArray(Arrays.asList(mArrayList));
                return myArray;
      }

Reconversion to Array

  var xval = JSON.parse(androidvalues.getNum11());
Ravi
  • 13
  • 1
  • 8
  • 1
    Yeah..Post some code first. – Anshul Tyagi Feb 23 '15 at 05:13
  • I am using example from this, but going no where, what is the method to convert array to json array and again back to array in webview http://stackoverflow.com/questions/10114993/how-to-pass-json-formatted-data-from-a-webview-to-a-html-page – Ravi Feb 23 '15 at 05:35
  • Its a simple example. Post code where you're getting trouble. – Anshul Tyagi Feb 23 '15 at 05:52

1 Answers1

0

The Json with Array is a huge challenge. Every example you can come across has some fixed data, mostly strings getting passed and parsed. Now getting a dynamically generated data array to be passed from Android activity to Webview is huge challenge. Now due to paucity of time. I have gone to not so good looking but workable model provided in example.

Android Cookbook A Crowd-sourced Cookbook on Writing Great Android® Apps

Kudos to this guy.

Ravi
  • 13
  • 1
  • 8