Я пытаюсь запустить новое действие, когда получаю разрешение, но ничего не происходит, даже если startActivity называется
private val nextButton by lazy { findViewById<Button>(R.id.nextButton) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_location_permission)
nextButton.setOnClickListener{
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), 102)
}
else{
//Works here
presentBubbleActivity(nextButton)
}
}
}
private fun presentBubbleActivity(view: View) {
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(this)
val revealX = (view.x + view.width / 2).toInt()
val revealY = (view.y + view.height / 2).toInt()
val intent = Intent(this, CameraPermissionActivity::class.java)
intent.putExtra(BubbleTransition.EXTRA_REVEAL_X, revealX)
intent.putExtra(BubbleTransition.EXTRA_REVEAL_Y, revealY)
startActivity(intent, options.toBundle())
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
if(requestCode == 102){
if ((grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
//Doesn't work here (but goes into the function and even calls 'startActivity'
presentBubbleActivity(nextButton)
}
}
}
В журналах не отображается сообщение об ошибке
Это выглядиткак новая активность на экране, но "невидимая", как я могу нажимать на кнопки.