【问题标题】:Reliable cross device android camera implementation?可靠的跨设备安卓相机实现?
【发布时间】:2011-12-18 13:51:28
【问题描述】:

谁能帮我解决这个问题?
下面的代码在我的 HTC Desire S 上完美运行,但在其他设备(我怀疑不是 HTC

另外,如果我连续拍摄超过 4 张照片,我的应用程序就会崩溃 - 这是一个已知问题吗?也许有人可能有我可以使用的自定义实现?

我目前正在使用此代码启动图像捕获并保存到特定位置:

Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, 0);

这是我的 onActivityResult 代码:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        Bitmap bm = null;

        switch (resultCode) {
        case 0:
            break;

        case -1:
            if (data != null) {

                try {
                    // first, open the bitmap so we can scale it down..
                    bm = Media.getBitmap(this.getContentResolver(),
                            outputFileUri);
..more code here ..

                } catch (Exception e) {
                    // log exception}
                }
            } else {
                // log image returned null data...
            }
        }

    }

我们将一如既往地为您提供帮助!

【问题讨论】:

  • 你能显示来自 logcat 的日志吗?

标签: android camera


【解决方案1】:

我认为这是三星硬件的一个众所周知的问题。看看这个blog post,它提供了一个hacky 解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 2013-11-12
    • 1970-01-01
    • 1970-01-01
    • 2014-09-19
    • 1970-01-01
    相关资源
    最近更新 更多