catching an exceptions thrown if no app can handle Dialpad

This commit is contained in:
tibbi 2020-05-25 12:12:45 +02:00
parent 3e5bbd69c8
commit e903a6f16e
3 changed files with 7 additions and 3 deletions

View File

@ -57,7 +57,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.28.21'
implementation 'com.simplemobiletools:commons:5.28.23'
implementation 'joda-time:joda-time:2.10.1'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'

View File

@ -438,7 +438,11 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
private fun launchDialpad() {
Intent(Intent.ACTION_DIAL).apply {
startActivity(this)
if (resolveActivity(packageManager) != null) {
startActivity(this)
} else {
toast(R.string.no_app_found)
}
}
}

View File

@ -23,6 +23,6 @@
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/medium_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_dialer" />
android:src="@mipmap/ic_dialer" />
</RelativeLayout>