handle OutOfMemoryError | IllegalArgumentException
This commit is contained in:
parent
5fadf7f47d
commit
ee87e43bcb
@ -7,7 +7,12 @@ import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
@Throws(FileNotFoundException::class, IOException::class)
|
||||
@Throws(
|
||||
FileNotFoundException::class,
|
||||
IOException::class,
|
||||
IllegalArgumentException::class,
|
||||
OutOfMemoryError::class
|
||||
)
|
||||
fun saveAs(context: Context, existingUri: Uri, saveAs: Uri) {
|
||||
|
||||
context.asInputStream(existingUri)?.use { inputStream ->
|
||||
|
@ -709,8 +709,7 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
|
||||
private void saveDocumentAs(Uri uri) {
|
||||
try {
|
||||
KtUtilsKt.saveAs(this, mUri, uri);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException | OutOfMemoryError | IllegalArgumentException e) {
|
||||
snackbar.setText(R.string.error_while_saving).show();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user