android - How to display the .pdf files
<p>My application have one button. if you click on that button then it calls the web service method and that web service method returns the web links(like <a href="http://www.kim-lai.com/images/Menu_100309.pdf" rel="nofollow">http://www.kim-lai.com/images/Menu_100309.pdf</a>). Here i am displaying the content using that link. my application works properly for the general links(like <a href="http://maps.google.com/maps" rel="nofollow">http://maps.google.com/maps</a>). But it fails for .pdf files. How to do it. can any body help me.</p>

<pre><code>java file
</code></pre>

<p>package com.ibkr.roadbrake;
   import android.app.Activity;
   import android.app.ProgressDialog;
   import android.content.Intent;
   import android.content.pm.ActivityInfo;
   import android.graphics.Color;
   import android.os.Bundle;
   import android.os.Handler;
   import android.view.KeyEvent;
   import android.view.View;
   import android.view.Window;
   import android.view.WindowManager;
   import android.view.View.OnClickListener;
   import android.webkit.WebChromeClient;
   import android.webkit.WebView;
   import android.webkit.WebViewClient;
   import android.widget.Button;
   import android.widget.LinearLayout;
   import android.widget.TextView;
   import android.widget.Toast;</p>

<p>public class RB_UpcomingExitsWebpage extends Activity {
        protected ProgressDialog web_pd;
    final Handler rb_web_pd_Handler = new Handler();</p>

<pre><code>public WebView webview; 

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);        
        requestWindowFeature(Window.FEATURE_NO_TITLE);                          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.upcoming_webview);
        webview = (WebView)findViewById(R.id.wv1);  
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setPluginsEnabled(true);
        webview.getSettings().setDomStorageEnabled(true);
        webview.getSettings().setBuiltInZoomControls(true);
        webview.getSettings().setSupportZoom(true);
        webview.getSettings().setAllowFileAccess(true);   


        web_pd = ProgressDialog.show(RB_UpcomingExitsWebpage.this, "", "Please wait...", true);
        Thread t = new Thread() {
        public void run() 
        {          
            webview.getSettings().setPluginsEnabled(true);
            webview.getSettings().setAllowFileAccess(true);     
            webview.getSettings().setSupportZoom(true);*/
            rb_web_pd_Handler.post(checked_LoginResp);
        }                                               
    };
    t.start();

   webview.setWebViewClient(new WebViewClient() {
   @Override
   public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
   {
            // Handle the error
   }

   @Override
   public boolean shouldOverrideUrlLoading(WebView view, String url)
   {
            view.loadUrl(url);
            return true;
        }
    });

    String page_url = getIntent().getStringExtra("page_url");
    webview.getSettings().setJavaScriptEnabled(true);   
    webview.getSettings().setAllowFileAccess(true); 
    webview.getSettings().setPluginsEnabled(true);
    webview.loadUrl(page_url);
   }

final Runnable checked_LoginResp = new Runnable(){
    public void run()
    {
        try
            {
            webview.setWebChromeClient(new WebChromeClient() {
                public void onProgressChanged(WebView view, int progress)
                {
                    if(progress == 100){
                        web_pd.dismiss();

                    }
                }
          });
        } 
           catch(Exception e)
           {
            e.printStackTrace();
        }
    }       
};

}
</code></pre>

<p>thanks</p>
