,同時學習科特林我嘗試創建makeSceneTransitionAnimation圖像過渡,但它並不像Java中工作,這是從適配器類我的代碼嘗試makeSceneTransitionAnimation在科特林
itemView.imageContent.setOnClickListener {
val i = Intent(context, ImagePreviewActivity::class.java)
i.putExtra("IMAGE", item.content)
val trans = context.getString(R.string.transition)
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
Activity(), itemView.imageContent, trans
)
context.startActivity(i, options.toBundle())
}
這是我logcat的
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.Window.hasFeature(int)' on a null object reference
at android.app.ActivityOptions.makeSceneTransitionAnimation(ActivityOptions.java:709)
at android.app.ActivityOptions.makeSceneTransitionAnimation(ActivityOptions.java:648)
at android.app.ActivityOptions.makeSceneTransitionAnimation(ActivityOptions.java:622)
at android.support.v4.app.ActivityOptionsCompat.makeSceneTransitionAnimation(ActivityOptionsCompat.java:172)
at com.docotel.binmaspublic.module.report.ReportAdapter$ViewHolder$bind$2.onClick(ReportAdapter.kt:130)
對不起,如果你發現這是一個重複的問題
好吧我錯了,NullPointer我排隊** val選項**? – MNFS