Note that there are some explanatory texts on larger screens.

plurals
  1. POerror in the transfert image
    text
    copied!<p>hello I have this error in the moment of i would like transfert a image in android. I don't understand why.</p> <p><strong>EDIT: I have find the raison.The raison are they have insuffisant allowed Memory. How to change the allowed memory?</strong> </p> <pre><code> 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 </code></pre> <p>The problem's are in line </p> <pre><code>Bitmap imgTaken = BitmapFactory.decodeFile(from, options); </code></pre> <p>The url file are correct I have verified</p> <p>This are the begin of my transfert function. </p> <pre><code>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); //... </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload