Am trying to use transitions in my App but am facing this problem,
Cannot cast Int to android.view.View
Below is my code:
holder.newsRoot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent newsIntent = new Intent(NewsAdapter.this.c, NewsDetails.class);
newsIntent.putExtra("newstitle",NewsTitle);
newsIntent.putExtra("detailednews",DetailedNews);
newsIntent.putExtra("newsdate",NewsDate);
newsIntent.putExtra("newsphoto",NewsPhoto);
ActivityOptionsCompat options= ActivityOptionsCompat.makeSceneTransitionAnimation(this,(View)news_image,"image_transit");
c.startActivity(newsIntent,options.toBundle());
}
});
Am trying to integrate it in the Adapter class
, but this is the line where the problem is :
`ActivityOptionsCompat options= ActivityOptionsCompat.makeSceneTransitionAnimation(this,(View)news_image,"image_transit")`;
** problem is found on these words**
(View)news_image
My xml code of the ImageView.
<ImageView
android:id="@+id/news_image"
android:layout_width="80dp"
android:transitionName="image_transit"
android:layout_height="80dp"
android:src="@drawable/bbb"/>