Есть класс
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ViewPagerAdapter adapter = new ViewPagerAdapter
(getSupportFragmentManager(), tabs.getTabCount());
viewPager.setAdapter(adapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabs));
ArrayList l = new ArrayList();
// l.add("Hello!");
xadapter = new MyAdapter(this,l);
}
}
Этот адаптер находится в другом пакете мне нужно в этот класс передать MainActivity из MainActivity
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class ViewPagerAdapter extends FragmentPagerAdapter {
int mNumOfTabs;
MyAdapter xadapter;
public ViewPagerAdapter(FragmentManager fm, int NumOfTabs) {
super(fm);
this.mNumOfTabs = NumOfTabs;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
OneFragment tab1 = new OneFragment();
tab1.act = MainActivity.this;
tab1.adapter = xadapter;