Skip to content

Instantly share code, notes, and snippets.

@felipebelluco
Created September 28, 2018 15:06
Show Gist options
  • Save felipebelluco/b947f40b42cb34924eafe14831d2eb96 to your computer and use it in GitHub Desktop.
Save felipebelluco/b947f40b42cb34924eafe14831d2eb96 to your computer and use it in GitHub Desktop.
AlertDialog.Builder(thisActivity).apply {
setMessage(R.string.more_info_dialog_message)
setTitle(R.string.more_info_dialog_title)
setPositiveButton(R.string.yes_please) { d, i ->
// Se o usuário quiser, requere novamente permissão à funcionalidade
ActivityCompat.requestPermissions(
thisActivity,
arrayOf(Manifest.permission.CALL_PHONE),
CALL_PHONE_RESULT_CODE)
}
// Se o usuário optar por não conceder a permissão, fecha a dialog
setNegativeButton(R.string.no_thanks) { d, i -> d.dismiss() }
}.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment