title: How to read PDF files from assets sub folder in android
body: <p>I have pdf files which are placed in assets sub folder. Iam showing the pdf files in the form of a list  view.When clicking on any list items ,it shows an error,"Pdf cannot be displayed,Path error".How to set path for sub folder in assets???</p>
  
  <p>Thanks in Advance!</p>
  
  <p>Here is my class.Please check the code below
  <img src="https://i.stack.imgur.com/hDgcR.png" alt="enter image description here"></p>
  
  <pre><code>public class PdfViewInformation extends Activity{
  
  ListView pdflist;
  String  itemValue;
  String valueinfo;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.pdfviewinfo);
  
       AssetManager asset = getAssets();
          try {
              final String[] arrdata = asset.list("pdffolder");
              List&lt;String&gt; pdflist = new ArrayList&lt;String&gt;();
              int size = arrdata.length;
              for(int i = 0;i&lt;size;i++)
              {
                if(arrdata[i].contains(".pdf"))
  
                {
                  pdflist.add(arrdata[i]); 
                 }
              }
              ArrayAdapter&lt;String&gt; adapter= new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,pdflist);
              ListView listView = (ListView) findViewById(R.id.listView1);
              listView.setAdapter(adapter);
                      listView.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
               public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                          int position, long id) {
  
                   valueinfo = (String)parent.getItemAtPosition(position); 
                   File file = new File("android.resource://com.example.timesampleexp/assets/pdffolder/"+valueinfo);        
                Log.i("jduhsr", ""+file);
                      Intent intent = new Intent(Intent.ACTION_VIEW);
                      intent.setDataAndType(Uri.fromFile(file),"application/pdf");
                      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                      startActivity(intent);
  
  
  
  
              }
  
  
          });
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
       }
  </code></pre>