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