Android Open Source - sqlite Main Fragment Adapter






From Project

Back to project page sqlite.

License

The source code is released under:

GNU General Public License

If you think the Android project sqlite listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.nimos.sqlite.fragment.adapter;
/*w w  w .j  ava  2 s. c  o m*/
import java.util.List;

import android.app.Fragment;
import android.app.FragmentManager;
import android.support.v13.app.FragmentPagerAdapter;


public class MainFragmentAdapter extends FragmentPagerAdapter{
  
  private List<Fragment> fragments; 
  private List<String> titles;
  public MainFragmentAdapter(FragmentManager fm) {
    super(fm);
  }
  public MainFragmentAdapter(FragmentManager fm, List<Fragment> fragments,List<String> titles) {  
        super(fm);  
        this.fragments = fragments;  
        this.titles = titles;
    }  
  @Override
  public Fragment getItem(int position) {
    if(fragments!=null&&position<fragments.size()){
      return fragments.get(position);
    }else{
      return null;
    }
  }

  @Override
  public int getCount() {
    if(fragments!=null){
      return fragments.size();
    }else{ 
      return 0;
    }
  }
  
   @Override
     public CharSequence getPageTitle(int position) {
     if(titles!=null&&position<fragments.size()){
       return titles.get(position);
     }else{
       return null;
     }
     }
}




Java Source Code List

com.nimos.sqlite.MainActivity.java
com.nimos.sqlite.bean.User.java
com.nimos.sqlite.fragment.OneFragment.java
com.nimos.sqlite.fragment.ThreeFragment.java
com.nimos.sqlite.fragment.TwoFragment.java
com.nimos.sqlite.fragment.adapter.MainFragmentAdapter.java