Skip to content

Commit b5ed794

Browse files
committed
properly handle launching the dialpad intent on Android 11
1 parent 7220062 commit b5ed794

File tree

1 file changed

+5
-2
lines changed
  • app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities

1 file changed

+5
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.simplemobiletools.contacts.pro.activities
33
import android.annotation.SuppressLint
44
import android.app.Activity
55
import android.app.SearchManager
6+
import android.content.ActivityNotFoundException
67
import android.content.Context
78
import android.content.Intent
89
import android.content.pm.ShortcutInfo
@@ -417,10 +418,12 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
417418

418419
private fun launchDialpad() {
419420
Intent(Intent.ACTION_DIAL).apply {
420-
if (resolveActivity(packageManager) != null) {
421+
try {
421422
startActivity(this)
422-
} else {
423+
} catch (e: ActivityNotFoundException) {
423424
toast(R.string.no_app_found)
425+
} catch (e: Exception) {
426+
showErrorToast(e)
424427
}
425428
}
426429
}

0 commit comments

Comments
 (0)