When I prepare the example "Display PDF in assets folder (inside APK)", I face with the error of "java.io.IOException: not create document. Error". It should be generated by the code:
The example "Display PDF using PdfRenderer" show how to display PDF stored in sdcard, this example show how to display PDF stored in assets inside APK.
First, you have to create assets folder and copy your PDF into it.
Then you have to edit aaptOptions in build.gradle (Module: app), not to compass "pdf" file.
android.graphics.pdf.PdfDocument enables generating a PDF document from native Android content. This example show how to create a two page PDF file using PdfDocument, store as "/sdcard/test.pdf". Then use last example Display PDF using PdfRenderer to view it.
(remark: if you use last example to view the PDF file, you have to change targetPdf = "/sdcard/test.pdf".)
ConstraintLayoutallows you to create large and complex layouts with a flat view hierarchy (no nested view groups). It's similar to RelativeLayout in that all views are layed out according to relationships between sibling views and the parent layout, but it's more flexible than RelativeLayout and easier to use with Android Studio's Layout Editor.
To use ConstraintLayout, make sure to install Support Repository of ConstraintLayout for Android and Solver for ConstraintLayout in Android SDK Manager:
Add dependency of ConstraintLayout library in your module-level build.gradle file:
In the toolbar or sync notification, click Sync Project with Gradle Files.
We can convert an existing layout to a constraint layout in Android Studio's Layout Editor: - Open your layout in Android Studio and click the Design tab at the bottom of the editor window. - In the Component Tree window, right-click the layout and click Convert layout to ConstraintLayout.
After finished, the helloworld default layout converted to: