Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In your intent, your have possibility to pass Serializable objects.</p> <p>Do to, you must create a class for serilizing/deserializing your image like this:</p> <pre><code> import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.Serializable; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Bitmap.CompressFormat; public class SerializableBitmap implements Serializable { private static final long serialVersionUID = 1208813848065674061L; private Bitmap bitmap; // Serialize image private void writeObject(java.io.ObjectOutputStream out) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.JPEG, 100, bos); byte[] bitmapdata = bos.toByteArray(); out.write(bitmapdata, 0, bitmapdata.length); } // Deserialize image private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); int b; while((b = in.read()) != -1) byteStream.write(b); byte bitmapBytes[] = byteStream.toByteArray(); bitmap = BitmapFactory.decodeByteArray(bitmapBytes, 0, bitmapBytes.length); } public Bitmap getBitmap() { return bitmap; } public void setBitmap(Bitmap bitmap) { this.bitmap = bitmap; } } </code></pre> <p>Fill free to use setBitmap() and getBitmap() methods to serialize/deserilize your bitmap, and in your intent put the serializable bitmap object:</p> <pre><code> intent.putExtra(extraDataKey, serializableBitmap); </code></pre> <p>But consider that this solution could cause performance problems if the image is too large.</p> <p>Hope it help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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