Yes, you can manage/load a pdf into a fragment. Quoting Android developer website, "Fragments behave somewhat like a nested activity that can define its own layout and manage its own lifecycle."
Since fragments have their own layout, you can easily add a PDFViewCtrl to it. For example:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<pdftron.PDF.PDFViewCtrl
android:id="@+id/pdfviewctrl"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars = "vertical|horizontal"/>
</LinearLayout >
On your fragment's onCreate() method you can get the reference to this PDFViewCtrl and then load the document into it. Just remember that fragments have a slightly different life-cycle than activities, and depending on what you want to achieve you need to have that in mind.
On Thursday, August 9, 2012 8:42:53 AM UTC-7, Giuseppe Vacatello wrote:
Hi!
Can I load a pdf into a fragment? It's the same like activity?
Thank you :)