catch an exception at getting the export destination file
This commit is contained in:
parent
61582c2c21
commit
94e9ecd4c6
|
@ -220,8 +220,12 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||||
if (requestCode == PICK_IMPORT_SOURCE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
|
if (requestCode == PICK_IMPORT_SOURCE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
|
||||||
tryImportContactsFromFile(resultData.data!!)
|
tryImportContactsFromFile(resultData.data!!)
|
||||||
} else if (requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
|
} else if (requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
|
||||||
|
try {
|
||||||
val outputStream = contentResolver.openOutputStream(resultData.data!!)
|
val outputStream = contentResolver.openOutputStream(resultData.data!!)
|
||||||
exportContactsTo(ignoredExportContactSources, outputStream)
|
exportContactsTo(ignoredExportContactSources, outputStream)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
showErrorToast(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue