Android PagerAdapter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PagerAdapter class.

This code example shows how to use the following methods:
        assertFalse(listener.onPageSelectedCalled);
        pager.setCurrentItem(pager.getCurrentItem());
        assertFalse(listener.onPageSelectedCalled);
    } 
 
    private static class TestPagerAdapter extends PagerAdapter { 
        @Override 
        public int getCount() { 
            return 3; 
        } 
 
        @Override 
        public boolean isViewFromObject(View view, Object object) {
            return false; 
        } 
    } 
 
    private static class TestOnPageChangeListener extends ViewPager.SimpleOnPageChangeListener { 
        public boolean onPageSelectedCalled;
 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		setContentView(mViewPager);
 
		mViewPager.setAdapter(new SamplePagerAdapter());
	} 
 
	static class SamplePagerAdapter extends PagerAdapter { 
 
		private static int[] sDrawables = { R.drawable.wallpaper, R.drawable.wallpaper, R.drawable.wallpaper,
				R.drawable.wallpaper, R.drawable.wallpaper, R.drawable.wallpaper }; 
 
		@Override 
		public int getCount() { 
			return sDrawables.length;
		} 
 
		@Override 
		public View instantiateItem(ViewGroup container, int position) {
			PhotoView photoView = new PhotoView(container.getContext());
			photoView.setImageResource(sDrawables[position]);
 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:notifyDataSetChanged
            return mLists.get(position);
        } 
 
        public void addList(IdleList list, int position) {
            mLists.add(position, list);
            notifyDataSetChanged(); 
        } 
 
        public void addList(IdleList list) {
            mLists.add(list);
            notifyDataSetChanged(); 
        } 
 
        public void removeList(IdleList list) {
            mLists.remove(list);
            notifyDataSetChanged(); 
        } 
 
        public void removeList(int index) {
            mLists.remove(index);
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:notifyDataSetChanged
 
	private List<View> views = null;
	private boolean isEndless = false;
	private int count = 0;
 
	public EndlessPagerAdapter(List<View> views) {
		setNewData(views);
	} 
 
	public void setNewData(List<View> views) {
		this.views = views;
		count = (isEndless ? Integer.MAX_VALUE : this.views.size());
		this.notifyDataSetChanged();
	} 
 
	@Override 
	public int getCount() { 
		return count;
	} 
 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    private final ArrayList<String> mPugUrls;
 
    private final Context mContext;
 
    public PugPagerAdapter(Context context, ArrayList<String> pugUrls) {
        mPugUrls = pugUrls;
        mContext = context;
    } 
 
    @Override 
    public int getCount() { 
        return null != mPugUrls ? mPugUrls.size() : 0;
    } 
 
    @Override 
    public View instantiateItem(ViewGroup container, int position) {
        NetworkedCacheableImageView imageView = new NetworkedCacheableImageView(mContext, null);
 
        String pugUrl = mPugUrls.get(position);
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:notifyDataSetChanged
	} 
 
	@Override 
	public void notifyDataSetChanged() { 
		refreshData(); 
		super.notifyDataSetChanged(); 
	} 
 
	protected Context getContext() {
		return mContext;
	} 
 
	private void refreshData() { 
		mItems = mController.getSelected();
	} 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
import static android.support.v4.app.Watson.OnCreateOptionsMenuListener; 
import static android.support.v4.app.Watson.OnOptionsItemSelectedListener; 
import static android.support.v4.app.Watson.OnPrepareOptionsMenuListener; 
 
public class SherlockFragment extends Fragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
    private SherlockFragmentActivity mActivity;
 
    public SherlockFragmentActivity getSherlockActivity() { 
        return mActivity;
    } 
 
    @Override 
    public void onAttach(Activity activity) {
        if (!(activity instanceof SherlockFragmentActivity)) {
            throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
        } 
        mActivity = (SherlockFragmentActivity)activity;
 
        super.onAttach(activity);
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    private final FragmentManager mFragmentManager;
    private FragmentTransaction mCurTransaction = null;
    private Fragment mCurrentPrimaryItem = null;
 
    public AppFragmentPagerAdapter(FragmentManager fm) {
        mFragmentManager = fm;
    } 
 
    /** 
     * Return the Fragment associated with a specified position. 
     */ 
    public abstract Fragment getItem(int position);
 
    @Override 
    public void startUpdate(ViewGroup container) {
    } 
 
    @Override 
    public Object instantiateItem(ViewGroup container, int position) {
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:notifyDataSetChanged
                newCursor.registerDataSetObserver(mDataSetObserver);
            } 
            mRowIDColumn = newCursor.getColumnIndexOrThrow("_id");
            mDataValid = true;
            // notify the observers about the new cursor 
            notifyDataSetChanged(); 
        } else { 
            mRowIDColumn = -1;
            mDataValid = false;
            // notify the observers about the lack of a data set 
            notifyDataSetChanged(); 
        } 
        return oldCursor;
    } 
 
    /** 
     * <p> Converts the cursor into a CharSequence. Subclasses should override this method to convert 
     * their results. The default implementation returns an empty String for null values or the default 
     * String representation of the value. </p> 
     * 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
package com.newsblur.fragment; 
 
import android.os.Bundle; 
import android.support.v4.app.Fragment; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 
 
import com.newsblur.R; 
 
public class LoadingFragment extends Fragment {
	 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		return inflater.inflate(R.layout.fragment_loadingitems, null);
	} 
 
} 

10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Android PagerAdapter Methods: