안녕하십니까. 지금 안드로이드에서 이미지를 전송하고 싶습니다. 나는 왜 그런지 이해하지 못한다.전송 이미지에 오류가 있습니다.
EDIT : 나는 raison.The를 찾아 냈다 raison.The 인피니트 허용 메모리가 있습니다. 허용 된 메모리를 변경하는 방법?
EDIT:FATAL EXCEPTION: main
java.lang.OutOfMemoryError
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587)
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:389)
07-18 08:50:35.169: E/AndroidRuntime(16772): at P12.transferImage(P12.java:503)
07-18 08:50:35.169: E/AndroidRuntime(16772): at P12.access$4(P12.java:487)
07-18 08:50:35.169: E/AndroidRuntime(16772): at P12$6.onClick(P12.java:313)
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.view.View.performClick(View.java:3644)
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.view.View$PerformClick.run(View.java:14313)
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.os.Handler.handleCallback(Handler.java:605)
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.os.Handler.dispatchMessage(Handler.java:92)
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.os.Looper.loop(Looper.java:137)
07-18 08:50:35.169: E/AndroidRuntime(16772): at android.app.ActivityThread.main(ActivityThread.java:4514)
07-18 08:50:35.169: E/AndroidRuntime(16772): at java.lang.reflect.Method.invokeNative(Native Method)
07-18 08:50:35.169: E/AndroidRuntime(16772): at java.lang.reflect.Method.invoke(Method.java:511)
07-18 08:50:35.169: E/AndroidRuntime(16772): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
07-18 08:50:35.169: E/AndroidRuntime(16772): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
07-18 08:50:35.169: E/AndroidRuntime(16772): at dalvik.system.NativeStart.main(Native Method)
07-18 08:55:44.474: I/Process(16772): Sending signal. PID: 16772 SIG: 9
07-18 08:55:44.764: D/dalvikvm(17129): GC_FOR_ALLOC freed 65K, 4% free 12756K/13187K, paused 16ms
문제의는
Bitmap imgTaken = BitmapFactory.decodeFile(from, options);
는 URL 파일 내가 내 TRANSFERT 기능으로 시작된다
이
을 확인했습니다 올바른지 라인에 있습니다.private void transferImage(String from,String imageName) throws IOException {
Log.i("debug","from:"+from.toString());
// we want remote host, user name and password
if (from == null || from.length() == 0) {
Toast.makeText(getBaseContext(), getString(R.string.errorFTPparameters), Toast.LENGTH_LONG).show();
setResult(11);
finish();
}
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inTempStorage = new byte[16*1024];
// byte array transfers
Bitmap imgTaken = BitmapFactory.decodeFile(from, options);
if (imgTaken == null) {
Toast.makeText(getBaseContext(), getString(R.string.errorcreatingstream), Toast.LENGTH_LONG).show();
setResult(11);
finish();
}
// transforming image into byte array
ByteArrayOutputStream bos = new ByteArrayOutputStream();
imgTaken.compress(CompressFormat.JPEG, 60, bos);
byte[] bitmapdata = bos.toByteArray();
// base64 encoding of the bytes in a string
String bos1 = Base64.encodeBytes(bitmapdata);
//...
스택 추적에 예외/오류 메시지도 함께 제공하십시오. –
감사합니다. 나는 오류의 첫 번째 부분을 잊어 버렸다. – Agriesean