handle exceptions thrown at using social media action buttons

This commit is contained in:
tibbi 2021-08-27 19:36:04 +02:00
parent 16b81e6254
commit 251df880ff

View File

@ -1,5 +1,6 @@
package com.simplemobiletools.contacts.pro.activities
import android.content.ActivityNotFoundException
import android.content.ContentUris
import android.content.Intent
import android.media.AudioManager
@ -681,7 +682,13 @@ class ViewContactActivity : ContactActivity() {
val uri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, action.dataId)
setDataAndType(uri, action.mimetype)
flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(this)
try {
startActivity(this)
} catch (e: ActivityNotFoundException) {
toast(R.string.no_app_found)
} catch (e: Exception) {
showErrorToast(e)
}
}
}
}