Advertisement
Guest User

Untitled

a guest
Dec 19th, 2011
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. CcActivity:
  2.  
  3.  
  4. package andprac.ch1;
  5.  
  6. import net.sf.andpdf.pdfviewer.PdfViewerActivity;
  7. import android.app.Activity;
  8. import android.content.Intent;
  9. import android.os.Bundle;
  10.  
  11. public class CcActivity extends Activity {
  12. /** Called when the activity is first created. */
  13. @Override
  14. public void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.main);
  17. /*
  18. * String FILE = "C:/ss.pdf";
  19. file = Environment.getExternalStorageDirectory().getPath() + "myFileName.pdf";
  20. PdfWriter.getInstance(document, new FileOutputStream(FILE));
  21. */
  22. try
  23. {
  24.  
  25. String filename = "/mnt/sdcard/sample3.pdf";
  26. // shortcuts.pdf it is in assets and raw folder please copy it to sdcard when you run this in device
  27.  
  28. Intent intent = new Intent(this, MyPdfAcitivty.class);
  29. intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, filename);
  30. startActivity(intent);
  31. }
  32. catch (Exception e)
  33. {
  34. e.printStackTrace();
  35. }
  36.  
  37. }
  38. }
  39.  
  40.  
  41.  
  42. MyPdfAcitivty
  43.  
  44.  
  45. package andprac.ch1;
  46.  
  47. import android.os.Bundle;
  48. import net.sf.andpdf.pdfviewer.PdfViewerActivity;
  49.  
  50. public class MyPdfAcitivty extends PdfViewerActivity{
  51.  
  52. @Override
  53. public void onCreate(Bundle savedInstanceState)
  54. {
  55. // TODO Auto-generated method stub
  56. super.onCreate(savedInstanceState);
  57.  
  58. }
  59.  
  60. public int getPreviousPageImageResource() {
  61. return R.drawable.left_arrow;
  62. }
  63.  
  64. public int getNextPageImageResource() {
  65. return R.drawable.right_arrow;
  66. }
  67.  
  68. public int getZoomInImageResource() {
  69. return R.drawable.zoom_in;
  70. }
  71.  
  72. public int getZoomOutImageResource() {
  73. return R.drawable.zoom_out;
  74. }
  75.  
  76. public int getPdfPasswordLayoutResource() {
  77. return R.layout.pdf_file_password;
  78. }
  79.  
  80. public int getPdfPageNumberResource() {
  81. return R.layout.dialog_pagenumber;
  82. }
  83.  
  84. public int getPdfPasswordEditField() {
  85. return R.id.etPassword;
  86. }
  87.  
  88. public int getPdfPasswordOkButton() {
  89. return R.id.btOK;
  90. }
  91.  
  92. public int getPdfPasswordExitButton() {
  93. return R.id.btExit;
  94. }
  95.  
  96. public int getPdfPageNumberEditField() {
  97. return R.id.pagenum_edit;
  98. }
  99.  
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement