-3

How can I create a viewpager with tablayout each tab containing pdfviewer loading a separate pdf file from asset folder.

thanks in advance.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

0

Follow below link to add view pager with TabLayout https://www.simplifiedcoding.net/android-tablayout-example-using-viewpager-fragments/

Now you can add PDF viewer in each fragment and can load pdf using a variable that will contain the name of pdf inside assets acc to tab. You can provide value to variable inside tablayout.setOnTabSelectedListener() overridden methods and can store in some variable.

S.Ambika
  • 292
  • 1
  • 14
  • I have about 40 separate PDF files. is it possible to load with one fragment in different tabs? – Mohammad Ali Moradi Dec 04 '19 at 04:27
  • then y are your going for tabs? you should go for recycler view. show pdf file name in list form and on click open in pdf viewer. in this way you will have just one Recycler view and one PDF Viewer – S.Ambika Dec 04 '19 at 04:35