title: Displaying pdf in a TextView from assets/raw folder in android
body: <p>I have two activity,MainActivity.java and SampleActivity.java.I have stored a .pdf file in assets folder.
  I have a button in my first activity.When i click that button i want the pdf file to be displayed in the textview of SampleActivity.java. The second activity also will have a download button to download the pdf file.</p>
  
  <p>I don't want to make use of webview or display using external program.
  I tried with .txt files and it worked correctly but same did'nt work with pdf file.</p>
  
  <p>Is there any method to achieve this.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Code that i used for .txt is</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_sample);
  
      txt=(TextView) findViewById(R.id.textView1);
  
      try
      {
          InputStream is=getAssets().open("hello.txt");
          int size=is.available();
          byte[] buffer=new byte[size];
          is.read(buffer);
          is.close();
  
          String text=new String(buffer);
  
          txt.setText(text);
      }
      catch(Exception e)
      {
          e.printStackTrace();
      }
  </code></pre>