title: Extract Lat Long from SQlite and display on webview
body: <p>At present i want to display the all lat long values on webview by accessing java method from javascript but it is not showing the lat long values.</p>
  
  <p>Please please help to cottect it</p>
  
  <p>Thank you </p>
  
  <p>this my WebviewActivity.java</p>
  
  <pre><code>static final String TAG = "JavascriptDataDemo";
  
  //double[] data = new double[] {42.6, 24, 17, 15.4};
  DataHelper myDB=new DataHelper(this);
  
  /** This passes our data out to the JS */
  @JavascriptInterface
  public String getData() {
      myDB.insert(16.5048, 80.6338);
      myDB.insert(16.5024,80.6432);
      myDB.insert(16.512,80.6216);
      myDB.insert(16.5124,80.6219);
  
      Cursor cursor = myDB.fetchAllCountries();
      double[] array = new double[cursor.getCount()];
      double[] array1=new double[cursor.getCount()];
      int i = 0;
      if (cursor.moveToFirst()) {
          do {
              double data = cursor.getDouble(cursor.getColumnIndex("lat"));
              double data1=cursor.getDouble(cursor.getColumnIndex("longt"));
              array[i] = data;
              array1[i]=data1;
              i++;
  
          } while (cursor.moveToNext());
  
      }
  
      Log.d(TAG, "getData() called");
      return a1dToJson(array,array1).toString();
  }
  
  /** Allow the JavaScript to pass some data in to us.
  @JavascriptInterface
  public void setData(String newData) throws JSONException {
      Log.d(TAG, "MainActivity.setData()");
      JSONArray streamer = new JSONArray(newData);
      data = new double[streamer.length()];
      for (int i = 0; i &lt; streamer.length(); i++) {
          Double n = streamer.getDouble(i);
          data[i] = n;
      }
  }*/
  
  private Activity activity;
  
  public Context getActivity() {
      return activity;
  }
  
  public void setActivity(Activity app) {
      this.activity = app;
  }
  
  @JavascriptInterface
  public void finish() {
      Log.d(TAG, "ArrayApplication.finish()");
      activity.finish();
  }
  
  /** Sorry for not using the standard org.json.JSONArray but even in Android 4.2 it lacks
   * the JSONArray(Object[]) constructor, making it too painful to use.
   */
  private String a1dToJson(double[] data,double[] data1) {
      StringBuffer sb = new StringBuffer();
      sb.append("[");
      for (int i = 0,j=0; (i &lt; data.length) &amp;&amp; (j&lt;data1.length); i++,j++) {
          double d = data[i];
          double s=data1[j];
          if (i &gt; 0 &amp;&amp; j&gt;0) {
              sb.append("[");
              sb.append(d);
              sb.append(",");
              sb.append(s);
              sb.append("]");
          }
      }
      sb.append("]");
      return sb.toString();
  }
  }
  </code></pre>
  
  <p>my index.html which access the android activity method to display the data</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;script&gt; 
      var showData = function() {
          var data = android.getData();
          data = JSON.parse(data);
          window.alert("Hello! Data are: " + data + "; first = " + data[0]);
      }
  
   &lt;/script&gt;
  
   &lt;/head&gt;
  
   &lt;body&gt;
  
  
   &lt;input type="button" value="Display data" onclick="showData()"&gt;
  
   &lt;input type="button" value="Update data" onclick="setData();"&gt;
  
   &lt;br/&gt;
  
   &lt;input type="button" value="Done" onclick="android.finish();"&gt;
  
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>