Open hatim-haffane opened 9 years ago
i cant open a pdf the app just crash
i used your simple code but not working
public static final String SAMPLE_FILE = "CyberLove.pdf";
public static final String ABOUT_FILE = "about.pdf"; PDFView pdfView; String pdfName = SAMPLE_FILE; Integer pageNumber = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pdf); pdfView = (PDFView) findViewById(R.id.pdfview); pdfView.fromAsset(SAMPLE_FILE).defaultPage(1) .showMinimap(false) .enableSwipe(true) .load(); //display(SAMPLE_FILE,true); } void afterViews() { display(pdfName, false); } public void about() { if (!displaying(ABOUT_FILE)) display(ABOUT_FILE, true); } private void display(String assetFileName, boolean jumpToFirstPage) { if (jumpToFirstPage) pageNumber = 1; setTitle(pdfName = assetFileName); pdfView.fromAsset(assetFileName) .defaultPage(pageNumber) .onPageChange(this) .load(); } @Override public void onPageChanged(int page, int pageCount) { pageNumber = page; setTitle(format("%s %s / %s", pdfName, page, pageCount)); } @Override public void onBackPressed() { if (ABOUT_FILE.equals(pdfName)) { display(SAMPLE_FILE, true); } else { super.onBackPressed(); } } private boolean displaying(String fileName) { return fileName.equals(pdfName); }
It looks like this lib should be minSdkVersion=11.
minSdkVersion=11
i cant open a pdf the app just crash
i used your simple code but not working
public static final String SAMPLE_FILE = "CyberLove.pdf";