Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4453aa4c authored by Mike Lockwood's avatar Mike Lockwood
Browse files

CameraBrowser: Catch ActivityNotFoundException when attempting to display imported file.



Change-Id: I448f2506caf0a5599c885654fd0078beb6240965
Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 1bfdfc63
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41,5 +41,6 @@
    <string name="save_failed_message">Could not save object</string>
    <string name="object_deleted_message">Object deleted</string>
    <string name="delete_failed_message">Could not delete object</string>
    <string name="start_activity_failed_message">Import succeeded, but could not display object</string>

</resources>
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.camerabrowser;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
@@ -155,7 +156,11 @@ public class ObjectViewer extends Activity implements View.OnClickListener {
        if (resultUri != null) {
            Toast.makeText(this, R.string.object_saved_message, Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(Intent.ACTION_VIEW, resultUri);
            try {
                startActivity(intent);
            } catch (ActivityNotFoundException e) {
                Toast.makeText(this, R.string.start_activity_failed_message, Toast.LENGTH_SHORT).show();
            }
        } else {
            Toast.makeText(this, R.string.save_failed_message, Toast.LENGTH_SHORT).show();
        }