0
 private void setupViewPager(ViewPager viewPager) {
        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
        adapter.addFrag(new CompanyActivity(), "ONE");
        adapter.addFrag(new CompanyActivitytwo(), "TWO");
        adapter.addFrag(new CompanyActivitythree(), "THREE");
        viewPager.setAdapter(adapter);
    }

class's CompanyActivity(),

CompanyActivitytwo(),

CompanyActivitythree()

are not fragments but i want to add them to the fragmentlist they all extends AppCompatActivity and this is CompanyActivity class code

public class CompanyActivity extends AppCompatActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.huf);

    } 

    public void one(View view) {
        Intent first=new Intent(CompanyActivity.this,CompanyDetalies.class);

        startActivity(first);
    }

    public void two(View view) {  Intent first=new Intent(CompanyActivity.this,CompanytwoDetalies.class);
        startActivity(first);
    }

    public void three(View view) { Intent first=new Intent(CompanyActivity.this,CompanythreeDetalies.class);
        startActivity(first);
    }

    public void four(View view) { Intent first=new Intent(CompanyActivity.this,CompanyfourDetalies.class);
        startActivity(first);
    }

    public void five(View view) { Intent first=new Intent(CompanyActivity.this,CompanyfiveDetalies.class);
        startActivity(first);
    }

    public void six(View view) {
        Intent first=new Intent(CompanyActivity.this,CompanysixDetails.class);
        startActivity(first);
    }


}
Lyla
  • 2,767
  • 1
  • 21
  • 23

1 Answers1

0

You can't use ViewPager with activities, you need to convert them to Fragments. See here for more details : Android PagerView between Activities

Community
  • 1
  • 1
Lyla
  • 2,767
  • 1
  • 21
  • 23