所以我正在开发一个LibGDX应用程序,我让用户选择一个图像,然后继续裁剪它。 我得到图像路径,然后我尝试启动裁剪意图,但我的应用程序崩溃错误 我使用正确的图像进入裁剪屏幕,但我的应用程序已经被杀死,当我点击保存时,我将返回到我的主屏幕:
07-11 22:26:24.142: E/AndroidGraphics(8692): waiting for pause synchronization took too long; assuming deadlock and killing
一些代码:
MainActivity:
String userImagePath = null;
AndroidGalleryOpener opener;
Uri imageUri;
public static final int SELECT_CROP_CODE = 2;
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == RESULT_OK)
switch (requestCode) {
case AndroidGalleryOpener.SELECT_IMAGE_CODE:
imageUri = data.getData();
this.userImagePath = getPath(imageUri);
Gdx.app.log("AndroidGalleryOpener", "Image path is " + userImagePath);
opener.setImageResult(userImagePath);
//////Cropping starts ;
System.out.println("Cropper called");
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(imageUri, "image/*");
intent.putExtra("crop", "true");
intent.putExtra("outputX", 256);
intent.putExtra("outputY", 256);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
//intent.putExtra("scale", true);
intent.putExtra("return-data", true);
startActivityForResult(intent, SELECT_CROP_CODE);
break;
case SELECT_CROP_CODE:
//get the returned data
Bundle extras = data.getExtras();
//get the cropped bitmap
Bitmap thePic = extras.getParcelable("data");
Gdx.app.log("Croper", "Croper on activity result ");
break;
default:
break;
}
}
logcat的:
07-11 22:26:07.306: I/AndroidGraphics(8692): coverage sampling: (false)
07-11 22:26:07.316: I/AndroidGraphics(8692): Managed meshes/app: { }
07-11 22:26:07.316: I/AndroidGraphics(8692): Managed textures/app: { }
07-11 22:26:07.316: I/AndroidGraphics(8692): Managed shaders/app: { }
07-11 22:26:07.316: I/AndroidGraphics(8692): Managed buffers/app: { }
07-11 22:26:07.646: I/dalvikvm-heap(8692): Grow heap (frag case) to 23.484MB for 4162562-byte allocation
07-11 22:26:12.411: I/dalvikvm-heap(8692): Grow heap (frag case) to 23.791MB for 4162562-byte allocation
07-11 22:26:13.932: I/AndroidGraphics(8692): paused
07-11 22:26:13.942: I/AndroidInput(8692): sensor listener tear down
07-11 22:26:13.982: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.022: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.022: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:14.032: W/ApplicationPackageManager(8692): getCSCPackageItemText()
07-11 22:26:15.704: W/IInputConnectionWrapper(8692): showStatusIcon on inactive InputConnection
07-11 22:26:20.108: I/AndroidGalleryOpener(8692): Image path is /storage/emulated/0/Download/Agent_Thompson.jpg
07-11 22:26:20.108: I/System.out(8692): Cropper called
07-11 22:26:20.128: I/SensorManagerA(8692): getReportingMode :: sensor.mType = 1
07-11 22:26:20.128: I/SensorManagerA(8692): getReportingMode :: sensor.mType = 2
07-11 22:26:20.128: I/AndroidInput(8692): sensor listener setup
07-11 22:26:24.142: E/AndroidGraphics(8692): waiting for pause synchronization took too long; assuming deadlock and killing
07-11 22:26:24.142: I/Process(8692): Sending signal. PID: 8692 SIG: 9