From 90ca8b34d823eed19d26f6611716ca231d60424c Mon Sep 17 00:00:00 2001 From: Renard Date: Tue, 5 Apr 2016 01:52:13 -0300 Subject: Initial commit --- .../baiparser/CustomFragmentPagerAdapter.java | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 app/src/main/java/org/bienvenidoainternet/baiparser/CustomFragmentPagerAdapter.java (limited to 'app/src/main/java/org/bienvenidoainternet/baiparser/CustomFragmentPagerAdapter.java') diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/CustomFragmentPagerAdapter.java b/app/src/main/java/org/bienvenidoainternet/baiparser/CustomFragmentPagerAdapter.java new file mode 100644 index 0000000..40052b8 --- /dev/null +++ b/app/src/main/java/org/bienvenidoainternet/baiparser/CustomFragmentPagerAdapter.java @@ -0,0 +1,53 @@ +package org.bienvenidoainternet.baiparser; + +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentPagerAdapter; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Renard on 04-03-2016. + */ + +public class CustomFragmentPagerAdapter extends FragmentPagerAdapter { + + // List of fragments which are going to set in the view pager widget + List fragments; + + /** + * Constructor + * + * @param fm + * interface for interacting with Fragment objects inside of an + * Activity + */ + public CustomFragmentPagerAdapter(FragmentManager fm) { + super(fm); + this.fragments = new ArrayList(); + } + + /** + * Add a new fragment in the list. + * + * @param fragment + * a new fragment + */ + public void addFragment(Fragment fragment) { + this.fragments.add(fragment); + } + + @Override + public Fragment getItem(int arg0) { + return this.fragments.get(arg0); + } + + @Override + public int getCount() { + return this.fragments.size(); + } + + + +} \ No newline at end of file -- cgit v1.2.1-18-gbd029