As part of Qoppa’s Android toolkit, there is a class called QPDFViewerView, which is an extensions of FrameLayout and can be included in an app by adding as a View in an Activity. This view is a complete implementation of a PDF viewer, based on the toolkit.

the intent of this class is to provide a near complete PDF viewer, that is configurable through the API, that you can quickly add to your own Android app to let your users display and navigate PDF documents.

A simple activity that includes the view would look like this:

public class ViewSample extends Activity {
  public void onCreate(Bundle saveInstBundle) {
    super.onCreate(saveInstBundle);
 
    QPDFViewerView viewer = new QPDFViewerView (this);
    viewer.setActivity(this);
 
    setContentView(viewer);
  }
}

A couple of tips:

– The application toolbar can be accessed with QPDFViewerView.getToolbar(). It can be customized with things like:

QPDFViewerView.getIbOpen().getParent().remove(QPDFViewerView.getIbOpen());

– You can prevent the Views from being destroyed on device rotation by adding this to your activity’s tag in your AndroidManifest.xml:

android:configChanges=”keyboardHidden|orientation|keyboard”

– You can forward the configuration event to QPDFViewerView and it will restore the previous scroll location by adding this to your activity:

@Override
public void onConfigurationChanged(Configuration newConfig) {
  super.onConfigurationChanged(newConfig);
  m_Viewer.onConfigurationChanged(newConfig);
}