我使用 android-pdf-viewer-library 在pdf查看器中显示pdf文件。但是我使用了以下方法和pdfViewer类来做到这一点。但我的问题是当pdfViewer打开时,会出现一个对话框“加载pdf页面”很长时间没有任何东西可以查看。谁能说出问题是什么?
import net.sf.andpdf.pdfviewer.PdfViewerActivity;
import android.os.Bundle;
public class PdfViewer extends PdfViewerActivity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public int getPreviousPageImageResource() {
return R.drawable.left_arrow;
}
public int getNextPageImageResource() {
return R.drawable.right_arrow;
}
public int getZoomInImageResource() {
return R.drawable.zoom_in;
}
public int getZoomOutImageResource() {
return R.drawable.zoom_out;
}
public int getPdfPasswordLayoutResource() {
return R.layout.pdf_file_password;
}
public int getPdfPageNumberResource() {
return R.layout.dialog_pagenumber;
}
public int getPdfPasswordEditField() {
return R.id.etPassword;
}
public int getPdfPasswordOkButton() {
return R.id.btOK;
}
public int getPdfPasswordExitButton() {
return R.id.btExit;
}
public int getPdfPageNumberEditField() {
return R.id.pagenum_edit;
}
}
在openPdf方法中:
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "Books/"+filename );
Intent intent = new Intent(MainContainer.this, PdfViewer.class);
intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, file);
startActivity(intent);
}
N.B。:pdfPath(文件)没问题