Android Open Source - 301Assignment1 Tabs Pager Adapter






From Project

Back to project page 301Assignment1.

License

The source code is released under:

Apache License

If you think the Android project 301Assignment1 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.ckchan.assignment1.adapter;
//from   w  w  w  .jav  a  2 s .c om
import com.ckchan.assignment1.ckchan_todolist.ArchiveFragment;
import com.ckchan.assignment1.ckchan_todolist.TodoFragment;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
//This code was taken from:
//http://stackoverflow.com/questions/16149778/how-do-i-use-fragmentpageradapter-to-have-tabs-with-different-content 2014-09-06
public class TabsPagerAdapter extends FragmentPagerAdapter {
 
    public TabsPagerAdapter(FragmentManager fm) {
      
        super(fm);
    }
 
    @Override
    public Fragment getItem(int i) {
 
        switch (i) {
        
        case 0:
            // TODO List fragment activity
            return new TodoFragment();
            
        case 1:
            // Archive fragment activity
            return new ArchiveFragment();
        };      
        return null;   
    }
 
    @Override
    public int getCount() {
      
        // 2 Tabs
        return 2;
    }
}




Java Source Code List

com.ckchan.assignment1.adapter.TabsPagerAdapter.java
com.ckchan.assignment1.adapter.TaskArrayAdapter.java
com.ckchan.assignment1.ckchan_todolist.ArchiveFragment.java
com.ckchan.assignment1.ckchan_todolist.DatabaseInterface.java
com.ckchan.assignment1.ckchan_todolist.Email.java
com.ckchan.assignment1.ckchan_todolist.MainActivity.java
com.ckchan.assignment1.ckchan_todolist.SettingsActivity.java
com.ckchan.assignment1.ckchan_todolist.SummaryInfoActivity.java
com.ckchan.assignment1.ckchan_todolist.TaskDatabase.java
com.ckchan.assignment1.ckchan_todolist.TaskFragmentInterface.java
com.ckchan.assignment1.ckchan_todolist.TodoFragment.java
com.ckchan.assignment1.ckchan_todolist.TodoTask.java