I got this error while trying to use Picasso with my adapter. I use Picasso because I get out-of-memory error on phones while it's working fine on tablets.
Am I using Picasso the wrong way? Cause I don't see any errors.
UPDATE THIS IS WHAT I EDIT
ImageView imgButtons;
        imgButtons = (ImageView) findViewById(R.id.items); 
       Picasso.with(context).load(flag[position]).fit().into(imgButtons);
        // Add viewpager_item.xml to ViewPager
        ((ViewPager) container).addView(imgButtons);
        return imgButtons;
I'm getting target must not be null Here's the code:
public class ViewPagerAdapter extends PagerAdapter {
    // Declare Variables
    Context context;
    int[] flag;
    String[] rank;
    LayoutInflater inflater;
    public ViewPagerAdapter(Context context,  int[] flag, String[] rank) {
        this.context = context;
        this.flag = flag;
        this.rank = rank;
    }
    @Override
    public int getCount() {
        return rank.length;
    }
    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == ((RelativeLayout) object);
    }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ImageView imgflag;
        inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View itemView = inflater.inflate(R.layout.app3x, container, false);
        // Locate the ImageView in viewpager_item.xml   
        // imgflag = (ImageView) itemView.findViewById(R.id.items);
        // Capture position and set to the ImageView
        // imgflag.setImageResource(flag[position]);
        Picasso.with(context).load(flag[position]).fit().into((Target) itemView);
        // Add viewpager_item.xml to ViewPager
        ((ViewPager) container).addView(itemView);
        return itemView;
    }
    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        // Remove viewpager_item.xml from ViewPager
        ((ViewPager) container).removeView((RelativeLayout) object);
    }
}
My XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center"
    android:orientation="vertical"
    android:background="@color/White">
    <ImageView
        android:id="@+id/items"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentRight="true"
        android:background="@color/White"
        android:scaleType="fitXY" />
</RelativeLayout>
 
    