title: fatal exception in reading browser history
body: <p>In my application, i want get the browser history, i tried with the following code, but it throw an exception, below is the code :</p>
  
  <pre><code>private static final Uri BOOKMARKS_URI = null;
  private static final String[] HISTORY_PROJECTION = null;
  private static final int HISTORY_PROJECTION_TITLE_INDEX = 0;
  private static final int HISTORY_PROJECTION_URL_INDEX = 0;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.browser);
  
      mWebView = (WebView) findViewById(R.id.webview);
      mWebView.getSettings().setJavaScriptEnabled(true);
      mWebView.getSettings().setBuiltInZoomControls(true);
      mWebView.loadUrl(turl);
  
      mWebView.setWebViewClient(new BrowserClient() {
  
          public void onPageFinished(WebView view, String url) {
              getBrowserHist();
          } 
      });
      }
      public void getBrowserHist()  {
         Cursor mCur = managedQuery(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, null, null, null);
         mCur.moveToFirst();
         if (mCur.moveToFirst() &amp;&amp; mCur.getCount() &gt; 0) {
              while (mCur.isAfterLast() == false) {
                   Log.v("titleIdx", mCur.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX));
                   Log.v("urlIdx", mCur.getString(Browser.HISTORY_PROJECTION_URL_INDEX));
                   mCur.moveToNext();
              }
          }
       }
  </code></pre>
  
  <p>but the program throw this exception :</p>
  
  <pre><code>   12-27 11:50:55.122: ERROR/AndroidRuntime(295): FATAL EXCEPTION: main
     12-27 11:50:55.122: ERROR/AndroidRuntime(295): java.lang.NullPointerException
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at android.content.ContentResolver.acquireProvider(ContentResolver.java:727)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at                                    android.content.ContentResolver.query(ContentResolver.java:239)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at android.app.Activity.managedQuery(Activity.java:1520)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at com.mobila.browser.Browser.getBrowserHist(Browser.java:108)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at com.mobila.browser.Browser$1.onPageFinished(Browser.java:70)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:274)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at android.os.Handler.dispatchMessage(Handler.java:99)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at android.os.Looper.loop(Looper.java:123)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at android.app.ActivityThread.main(ActivityThread.java:4627)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at java.lang.reflect.Method.invokeNative(Native Method)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at java.lang.reflect.Method.invoke(Method.java:521)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
     12-27 11:50:55.122: ERROR/AndroidRuntime(295):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>So, if someone has already use this code to read the browser history, tell me plz where I m wrong, or any help ..</p>
  
  <p>Thanks</p>