我搜索了很多,發現堆棧溢出的一些線程,但它沒有幫助。我試圖通過調用一個Intent來使用Android的內置相機。這適用於2.1,但在2.2我得到「致命的例外:GLThread 11」的例外。Android上的「致命例外:GLThread 11」froyo 2.2
我看了這個題目 Camera crashes in Android 2.2
而谷歌線程 http://code.google.com/p/android/issues/detail?id=7909
String fileName = Environment.getExternalStorageDirectory().getAbsolutePath() + "temp-" + System.currentTimeMillis() + ".jpg";
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, fileName);
values.put(MediaStore.Images.Media.DESCRIPTION,"Image capture by camera");
imageUri = ctx.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
//intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra(MediaStore.EXTRA_OUTPUT, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
//http://marakana.com/forums/android/examples/39.html
ctx.startActivityForResult(intent, REQUEST_CODE);
這是我用來調用攝像頭的代碼。直覺我猜。但是當我拍攝照片並點擊「保存」/「接受」按鈕時,應用程序在Android 2.2中崩潰。在我看來,它是標準的代碼和功能。我如何使用內置相機。我嘗試了幾件事情。