0
ich mit Android Ernte Bild arbeiten, das ist mein Code für das Zuschneiden Bild:Android- Ernte Bild Ausführen funktioniert nicht richtig
private void performCrop() {
try {
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(picUri, "image/*");
//set crop properties
cropIntent.putExtra("crop", "true");
//indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
//indicate output X and Y
cropIntent.putExtra("outputX", 500);
cropIntent.putExtra("outputY", 500);
//retrieve data on return
cropIntent.putExtra("return-data", true);
//start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP);
} catch (ActivityNotFoundException anfe) {
//display an error message
String errorMessage = "err";
Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
toast.show();
}
}
ich diesen Code getestet auf Android 4.2, 4.3 und das war keine Problem, aber auf Android 5,6, gibt es null Zeiger Ausnahme und ich weiß nicht warum.
Was ist falsch an diesem Code? Wie kann ich es mit allen Android-Versionen kompatibel machen?
Vergewissern Sie sich, dass Sie das Berechtigungsmodell für Android 6 – Jai
angewendet haben. Veröffentlichen Sie Ihr logcat –