I am trying to start an activity on clicking an ImageView in a recyclerview. In the adapterclass I have used a clicked listener in the onBindHolder method as shown below
viewHolder.savedImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context, PhotoActivity_.class);
view.getContext().startActivity(intent);
}
});
For some reason, there is this ridiculous delay before the activity start. No such delays when starting activities on clicking on view in the Main layouts just on clicking views in the row of a recyclerview.
I am attempting to animate an imageview to full screen using a shared element. I have been able to achieve that in the following way,
viewHolder.resultImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context, PhotoActivity_.class);
intent.putExtra(PhotoActivity.KEY_IMAGE_FILE_PATH, imageBeans.get(i).getImageFilePath());
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, view, "imageScale");
context.startActivity(intent, options.toBundle());
}
});
but this delay in starting the activity is something I cannot figure out.