set adapter paths in the constructor

This commit is contained in:
tibbi 2016-04-25 21:08:13 +02:00
parent 86a0495a2f
commit de84071cc0
2 changed files with 2 additions and 6 deletions

View File

@ -66,8 +66,7 @@ public class ViewPagerActivity extends AppCompatActivity
if (isDirEmpty())
return;
final MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager());
adapter.setPaths(photos);
final MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager(), photos);
pager.setAdapter(adapter);
pager.setCurrentItem(pos);
pager.addOnPageChangeListener(this);

View File

@ -11,11 +11,8 @@ import java.util.List;
public class MyPagerAdapter extends FragmentStatePagerAdapter {
private List<String> paths;
public MyPagerAdapter(FragmentManager fm) {
public MyPagerAdapter(FragmentManager fm, List<String> paths) {
super(fm);
}
public void setPaths(List<String> paths) {
this.paths = paths;
}