title: Android :How to call Cordova(WebView) loadUrl function
body: <p>Well i am into a VOIP application development.Below is my architecture.
  <br>UI: Uses Cordova with JS functions.
  <br>Sencha Touch : HTML5 Framework.
  <br>Backend: uses C code(engine).
  <br>JNI: Use JNI to call C function and Vice Versa.
  <br>Platform: Android.</p>
  
  <p>Now we have a single activity which extends the Cordova.</p>
  
  <p>Cordova:
  <br>1)Has an activity which loads a webview.
  <br>2)All we call is <a href="http://developer.android.com/reference/android/webkit/WebView.html#loadUrl%28java.lang.String%29" rel="nofollow">loadUrl</a> with JS functions
  <br>3)JS functions will take <a href="http://developer.android.com/reference/org/json/JSONArray.html" rel="nofollow">JSONArray</a> as data,or just a UI display JS function.</p>
  
  <p>**Right now we call loadUrl in AsyncTask and by creating Handler in broadcastreceiver ,and on <a href="http://developer.android.com/reference/android/app/Activity.html#runOnUiThread%28java.lang.Runnable%29" rel="nofollow">runOnUiThread</a> of activity.
  We see some lag in UI transitions and ANR's.  **</p>
  
  <p>Data is received from non UI thread,Now how do i call loadUrl function?</p>
  
  <p><br>1) Doc says(Loads the given URL), which means it should be called on UI main thread only?
  <br>2) Can i create a Handler in plain java class and call loadUrl in handleMessage function?
  <br>3)Create a handler in main activity and call loadUrl in handleMessage?
  <br>4)runOnUiThread is best way?
  <br>5)If the loadUrl should be called on UI main thread how do achieve the same?
  <br>6)What is best way to call loadUrl?</p>