handle Camera.open() fail gracefully

This commit is contained in:
tibbi
2016-04-19 13:24:56 +02:00
parent 6ce7b5e2e4
commit d3d2f5e23d
3 changed files with 17 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
package com.simplemobiletools.camera;
import android.content.Context;
import android.hardware.Camera;
import android.widget.Toast;
public class Utils {
public static Camera.CameraInfo getCameraInfo(int cameraId) {
@@ -8,4 +10,8 @@ public class Utils {
Camera.getCameraInfo(cameraId, info);
return info;
}
public static void showToast(Context context, int resId) {
Toast.makeText(context, context.getResources().getString(resId), Toast.LENGTH_SHORT).show();
}
}