Read a PDF file which is in Assets folder and display its contents
<p>I code for reading the PDF file in android which is in assets folder ,but its throughing
IO exception.</p>

<pre><code>public class FileReadActivity extends Activity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
 Button b1 = (Button)findViewById(R.id.button);

       b.setOnClickListener(new OnClickListener(){
         public void onClick(View arg0) {
       InputStream instream = getResources().getAssets().open("ard.pdf");
      if (instream != null) {
          // prepare the file for reading
          InputStreamReader inputreader = new InputStreamReader(instream);
          BufferedReader buffreader = new BufferedReader(inputreader);

          String line;

          // read every line of the file into the line-variable, on line at the time
          while (( line = buffreader.readLine()) != null) {


                              TextView t = (TextView)findViewById(R.id.text);

                              t.setText(line);


        }

        // close the file again
        instream.close();
        }

        else
        {
            Toast.makeText(FileReadActivity.this, 
                    "No Application Available to View PDF", 
                        Toast.LENGTH_SHORT).show();
        }
        // do something if the myfilename.txt does not exits
        } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
     }

   }});

      }


}
</code></pre>

<p>Can anybody tell me the solution?</p>
