0

Error Cannot resolve symbol "pdf.viewer.activity" code and error picture

public class MainActivity extends AppCompatActivity ,net.sf.andpdf.pdfviewer.PdfViewerActivity {

/**
 * The {@link android.support.v4.view.PagerAdapter} that will provide
 * fragments for each of the sections. We use a
 * {@link FragmentPagerAdapter} derivative, which will keep every
 * loaded fragment in memory. If this becomes too memory intensive, it
 * may be best to switch to a
 * {@link android.support.v4.app.FragmentStatePagerAdapter}.
 */

Context context;
/**
 * The {@link ViewPager} that will host the section contents.
 */
PDFView pdfView;

String[] abc={"kotlin.pdf","book1.pdf","book2.pdf"};
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
 pdfView= (PDFView) findViewById(R.id.pdfView);
   pdfView.fromAsset(abc[1]).load();




}
}
Lal
  • 14,726
  • 4
  • 45
  • 70
  • 1
    you can only extend one class so remove appcompat – Pavneet_Singh Feb 09 '18 at 18:22
  • You can only Extend a single class. And implement Interfaces from many sources. See [this](https://stackoverflow.com/a/5836735/3168859) – Lal Feb 09 '18 at 18:23
  • Sir, Thank you! for your answer! Sir, I found this error after removing the AppCompatActivity! Error:(22, 37) error: package com.github.barteksc.pdfviewer does not exist – Faizan Ashraf Feb 09 '18 at 18:37

1 Answers1

1

Theres no multiple inheritance in Java:

public class MainActivity extends AppCompatActivity ,net.sf.andpdf.pdfviewer.PdfViewerActivity {

Should be only one class, probably PdfViewerActivity in your case:

public class MainActivity extends net.sf.andpdf.pdfviewer.PdfViewerActivity {
Marcos Vasconcelos
  • 18,136
  • 30
  • 106
  • 167