When sending a picture, there is an offset by one article !! (Ie, when I click on the picture that I need, it opens which is on the next article))
I pass this way:
public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostViewHolder> { private LayoutInflater mInflater; private int mShowStyle; VKPostArray obj; VKApiPost p; VKApiPhoto vkPhoto; ArrayList<String> imgUrls1; VKApiUser mainUser; ArrayList<String> al; Collection l; Context ctx; Picasso picasso; public PostAdapter(Context context, VKPostArray posts, VKApiUser user, int showStyle) { super(); this.obj = posts; this.mainUser = user; this.mInflater = LayoutInflater.from(context); this.mShowStyle = showStyle; } @Override public void onBindViewHolder(PostViewHolder holder, int position) { p = obj.get(position); holder.textPost.setText(p.text); holder.textlikePost.setText(" " + p.likes_count); holder.textrepostPost.setText(" " + p.reposts_count); SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm"); holder.textDatePost.setText(format.format(new java.util.Date(p.date * 1000))); VKAttachments att = new VKAttachments(); att = p.attachments; int i; imgUrls1 = new ArrayList<>(); try { for (i = 0; i <= att.size(); i++) { vkPhoto = (VKApiPhoto) att.get(i); imgUrls1.add(vkPhoto.photo_604); } } catch (Exception e) { holder.mNglContent.setImagesData(imgUrls1); } } @Override public int getItemCount() { return obj.size(); } @Override public PostViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (mShowStyle == NineGridImageView.STYLE_FILL) { return new PostViewHolder(mInflater.inflate(R.layout.recycler_item_wall, parent, false)); } else { return new PostViewHolder(mInflater.inflate(R.layout.recycler_item_wall, parent, false)); }} public class PostViewHolder extends RecyclerView.ViewHolder { CardView cv; TextView textPost, news_name, textDatePost, textrepostPost, textlikePost; ImageView like, repost ; NineGridImageView mNglContent; private NineGridImageViewAdapter<String> mAdapter = new NineGridImageViewAdapter<String>() { @Override protected void onDisplayImage(Context context, ImageView imageView, String s) { Picasso.with(context).load(s).placeholder(R.drawable.ic_ab_app).into(imageView); } @Override protected ImageView generateImageView(Context context) { return super.generateImageView(context); } @Override protected void onItemImageClick(Context context, int position, List<String> list) { Intent intent = new Intent(context, FullPhoto.class); intent.putExtra(Constants.BUNDLE_BITMAP, imgUrls1); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }; public PostViewHolder(View itemView) { super(itemView); cv = (CardView) itemView.findViewById(R.id.card_view_wall); news_name = (TextView) itemView.findViewById(R.id.news_name); textDatePost = (TextView) itemView.findViewById(R.id.textDatePost); textPost = (TextView) itemView.findViewById(R.id.textPost); textlikePost = (TextView) itemView.findViewById(R.id.tv_likes_count); textrepostPost = (TextView) itemView.findViewById(R.id.tv_reposts_count); like = (ImageView) itemView.findViewById(R.id.iv_like); repost = (ImageView) itemView.findViewById(R.id.iv_repost); mNglContent = (NineGridImageView) itemView.findViewById(R.id.ngl_images); mNglContent.setAdapter(mAdapter); } } I accept this:
ar1 = getIntent().getExtras().getStringArrayList(Constants.BUNDLE_BITMAP); according to debugger, it already leaves onItemImageClick with offset
@Override protected void onItemImageClick(Context context, int position, List<String> list) { Intent intent = new Intent(context, FullPhoto.class); intent.putExtra(Constants.BUNDLE_BITMAP, imgUrls1); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }; Maybe someone knows how to fix ????