I've added the widget to my layout as:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.es.creativitic.caf.PdfViewer">
<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.constraint.ConstraintLayout>
And in my activity I load the pdf file from the assets folder like this:
import com.github.barteksc.pdfviewer.PDFView;
public class PdfViewer extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pdf_viewer);
PDFView viewer = (PDFView) findViewById(R.id.pdfView);
Log.d("PdfViewer", "It worked!");
viewer.fromAsset("Android SQLite Essentials.pdf");
}
}
But when I run the app, it enters the activity but just the action bar appears and the rest of the layout remains white.
There is any problem with the code or I just missed something in the documentation?
Thanks
I've solved the issue. I was missing the load() method.
Can you please elaborate how you solved it? @agarcialeon
Most helpful comment
I've solved the issue. I was missing the load() method.