Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid-Code to Implement PDF Viewer
    primarykey
    data
    text
    <p>Here i need to use Pdf-Viewer in my app.i took many API as a reference but still stucking up in viewing Pdf files from SDCARD. here my code</p> <p>`<strong>First.java</strong></p> <pre><code>public class First extends ListActivity { String[] pdflist; File[] imagelist; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); File images = Environment.getExternalStorageDirectory(); imagelist = images.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return ((name.endsWith(".pdf"))); } }); pdflist = new String[imagelist.length]; for (int i = 0; i &lt; imagelist.length; i++) { pdflist[i] = imagelist[i].getName(); } this.setListAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, pdflist)); } protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); String path = imagelist[(int) id].getAbsolutePath(); openPdfIntent(path); } private void openPdfIntent(String path) { try { final Intent intent = new Intent(First.this, Second.class); intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path); startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }} </code></pre> <p><strong>Second.java</strong></p> <pre><code>public class Second extends PdfViewerActivity { @Override public int getPreviousPageImageResource() { // TODO Auto-generated method stub return R.drawable.left_arrow; } @Override public int getNextPageImageResource() { // TODO Auto-generated method stub return R.drawable.right_arrow; } @Override public int getZoomInImageResource() { // TODO Auto-generated method stub return R.drawable.zoom_in; } @Override public int getZoomOutImageResource() { // TODO Auto-generated method stub return R.drawable.zoom_out; } @Override public int getPdfPasswordLayoutResource() { // TODO Auto-generated method stub return R.layout.pdf_file_password; } @Override public int getPdfPageNumberResource() { // TODO Auto-generated method stub return R.layout.dialog_pagenumber; } @Override public int getPdfPasswordEditField() { // TODO Auto-generated method stub return R.id.etPassword; } @Override public int getPdfPasswordOkButton() { // TODO Auto-generated method stub return R.id.btOK; } @Override public int getPdfPasswordExitButton() { // TODO Auto-generated method stub return R.id.btExit; } @Override public int getPdfPageNumberEditField() { // TODO Auto-generated method stub return R.id.pagenum_edit; }} </code></pre> <p>And i used <a href="https://github.com/jblough/Android-Pdf-Viewer-Library" rel="nofollow">Android-Pdf-Reader-Library</a> project.in my emulator Dialogue as"Loading pdf file" is appearing after clicking on Pdf files. And Can you anyone tell me how to Change the Pdf pages by swiping with finger??</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload