Implement Pdf Viewer Library for Android

It seems that this is the only PDF reader for a free android that is not dependent on MuPDF.

I try to prove it, I downloaded the project , but to get it started I get an exception:

01-17 13:45:03.960: E/AndroidRuntime(13631): FATAL EXCEPTION: main 01-17 13:45:03.960: E/AndroidRuntime(13631): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{net.sf.andpdf.pdfviewer/net.sf.andpdf.pdfviewer.PdfViewerActivity}: java.lang.InstantiationException: can't instantiate class net.sf.andpdf.pdfviewer.PdfViewerActivity 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1894) 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.app.ActivityThread.access$600(ActivityThread.java:128) 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.os.Handler.dispatchMessage(Handler.java:99) 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.os.Looper.loop(Looper.java:137) 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.app.ActivityThread.main(ActivityThread.java:4514) 01-17 13:45:03.960: E/AndroidRuntime(13631): at java.lang.reflect.Method.invokeNative(Native Method) 01-17 13:45:03.960: E/AndroidRuntime(13631): at java.lang.reflect.Method.invoke(Method.java:511) 01-17 13:45:03.960: E/AndroidRuntime(13631): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 01-17 13:45:03.960: E/AndroidRuntime(13631): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 01-17 13:45:03.960: E/AndroidRuntime(13631): at dalvik.system.NativeStart.main(Native Method) 01-17 13:45:03.960: E/AndroidRuntime(13631): Caused by: java.lang.InstantiationException: can't instantiate class net.sf.andpdf.pdfviewer.PdfViewerActivity 01-17 13:45:03.960: E/AndroidRuntime(13631): at java.lang.Class.newInstanceImpl(Native Method) 01-17 13:45:03.960: E/AndroidRuntime(13631): at java.lang.Class.newInstance(Class.java:1319) 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.app.Instrumentation.newActivity(Instrumentation.java:1027) 01-17 13:45:03.960: E/AndroidRuntime(13631): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1885) 

In the readme of the project, the last step I cannot understand.

6) Call your PdfViewActivity obtained using the following code:

  Intent intent = new Intent(this, YourPdfViewerActivity.class); intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, "PATH TO PDF GOES HERE"); startActivity(intent); 

Can someone explain to me what this step is? Or even more important: was someone able to use this PDF reader?

thanks

+6
source share
1 answer

The problem is that the PdfViewerActivity that you are trying to create in your Intent is an abstract class and cannot be created (class reference here ). You need to create an Activity that extends PdfViewerActivity by implementing any abstract method that the class has. Something like that:

 public class MyPdfViewerActivity extends PdfViewerActivity { //Your implementation code here. } 
+7
source

All Articles