B
Butch78
Neues Mitglied
- 0
Hi Leute,
ich würde euch gerne bitten mir bei einem kleinen Problem zu helfen.
Ich greife in meiner App auf die Kamera zu um anschließend das aufgenommene Bild zu verarbeiten.
Der Zugriff auf die Kamera klappt. Mit mein USB Speicher ist mit dem Rechner verbunden (Im Explorer sehe ich den Wechseldatenträger und im Handydisplay steht "USB-Speicher wird verwendet).
Im Manifest habe ich noch folgende Rechte gesetzt:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Wenn ich nun aber meine App debuggen will, bekomme ich immer die Meldung (sobald ich die Kamera öffne): Warnung: Speicherkarte zur Verwendung der Kamera einlegen...
Die ist doch aber drin...
Verstehe das grad nicht ganz. Hoffe ihr könnt mir helfen?
Gruß
Butch
ich würde euch gerne bitten mir bei einem kleinen Problem zu helfen.
Ich greife in meiner App auf die Kamera zu um anschließend das aufgenommene Bild zu verarbeiten.
Der Zugriff auf die Kamera klappt. Mit mein USB Speicher ist mit dem Rechner verbunden (Im Explorer sehe ich den Wechseldatenträger und im Handydisplay steht "USB-Speicher wird verwendet).
Im Manifest habe ich noch folgende Rechte gesetzt:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Wenn ich nun aber meine App debuggen will, bekomme ich immer die Meldung (sobald ich die Kamera öffne): Warnung: Speicherkarte zur Verwendung der Kamera einlegen...
Die ist doch aber drin...
Verstehe das grad nicht ganz. Hoffe ihr könnt mir helfen?
Gruß
Butch
Code:
[SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onButtonClick(View view){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Intent intent = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Intent(MediaStore.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]ACTION_IMAGE_CAPTURE[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
intent.putExtra(MediaStore.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]EXTRA_OUTPUT[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], Uri.[I]fromFile[/I](getTempFile([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])) );
startActivityForResult(intent, [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TAKE_PHOTO_CODE[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] File getTempFile(Context context){
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//it will return /[U]sdcard[/U]/image.tmp[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] File path = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] File( Environment.[I]getExternalStorageDirectory[/I](), context.getPackageName() );
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](!path.exists()){
path.mkdir();
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] File(path, [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"image.tmp"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
}[/LEFT]
[/SIZE]