Code example for ViewPager

Methods: getContext, onFinishInflate, setBackgroundDrawable

        setIndicator(0, 0); 
    protected void onFinishInflate() { 
        // Available after 1.6, sets the shortcut pages background with the device's wallpaper. 
        Drawable wallpaper = Wallpaper.get(getContext());
        if(wallpaper != null)
    protected void onPageScrolled(int position, float offset, int offsetPixels) {
        super.onPageScrolled(position, offset, offsetPixels);
        setIndicator(position, offset);
    private void setIndicator(int position, float offset) {
Connect your IDE to all the code out there  Get Codota for Java