overridePendingTransition in Image Adapter and View Holder

3080 views java
-1

I am trying to call an overridePendingTransition in a view holder. I have tried several solutions and haven't been able to find one that works. I have called the intent with the overridePendingTransition but doesn't work.

@Override
public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
    String groupName = mDataset.get(position);
    int groupImage = mGroupImageArray[position];
    holder.mImageView.setBackgroundResource(groupImage);
    holder.mTextViewGroupName.setText(groupName);
    holder.mParentLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent groupIntent = new Intent(mActivity, ShowGroupActivity.class);
            groupIntent.putExtra("groupName", mDataset.get(position));
            groupIntent.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
            mActivity.startActivity(groupIntent);
        }
    });
}

answered question

1 Answer

10

Intent class does not have the method overridePendingTransition, however you can it on an activity:

mActivity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
mActivity.startActivity(groupIntent);

posted this

Have an answer?

JD

Please login first before posting an answer.