簡體   English   中英

傳遞byte []時,Android返回上一個活動

[英]Android backs to previous activity when passing byte[]

我越來越煩人的錯誤:

12-12 03:46:48.241 23461-23461/com.cronline.haito.projectbeggining W/EGL_genymotion: eglSurfaceAttrib not implemented
12-12 03:46:48.241 23461-23461/com.cronline.haito.projectbeggining E/OpenGLRenderer: Getting MAX_TEXTURE_SIZE from GradienCache
12-12 03:46:48.245 23461-23461/com.cronline.haito.projectbeggining E/OpenGLRenderer: Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
12-12 03:46:48.245 23461-23461/com.cronline.haito.projectbeggining D/OpenGLRenderer: Enabling debug mode 0

當我嘗試打開某些圖像時會發生這種情況,當它發生時會退回到上一個活動。

而且我不知道是什么原因造成的。 僅當通過某些照片時才會發生。 但是我找不到它們之間的區別,因為我有幾乎兩個相同的圖像,一個導致問題,而另一個則沒有。 它們具有相同的分辨率685x960,大小為60KB。

編碼:

Passing to the second activity
Intent intent = new Intent(getActivity(), EditorActivity.class);
intent.putExtra("image", BitmapTransformer.compress(bitmap));
startActivity(intent);

壓縮和解壓縮方法:

public static byte[] compress(Bitmap bmp){
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        bmp.compress(Bitmap.CompressFormat.PNG, 80, stream);
        return stream.toByteArray();
    }
public static Bitmap decompress(byte[] data){
    return BitmapFactory.decodeByteArray(data, 0, data.length);
}

並接收圖像:

Intent intent = getIntent();
byte[] imageAsByteArray = intent.getExtras().getByteArray("image");
Bitmap bitmap = BitmapTransformer.decompress(imageAsByteArray);

圖片導致問題: https//www.dropbox.com/sh/ylwhbpdx41w6x2u/AAAUtQsYppge5kb7dEBHuouHa?dl = 0

您將把位圖保存到文件,僅發送文件名的路徑,然后再次從路徑讀取。 是pos

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM