當前位置:首頁 » 安卓系統 » androidbyte轉圖片

androidbyte轉圖片

發布時間: 2022-04-27 08:12:53

㈠ android 點擊一張圖片把圖片的信息傳到下一個activity圖片是一個byte[]

Bundle.putByteArray(key,value);第一個activity 調用這個方法把bundle 放到 intent 當中,第二個通過key 值取出來。

㈡ android如何由數組保存成圖片並保存在SD卡上

Bitmap bm = BitmapFactory.decodeByteArray(byte[] data, int offset, int length);別忘了判斷數組是不是為空。

保存。。。。
public void saveFile(Bitmap bm, String fileName) throws IOException {
private final static String ALBUM_PATH
= Environment.getExternalStorageDirectory() + "/download_test/";

File dirFile = new File(ALBUM_PATH);
if(!dirFile.exists()){
dirFile.mkdir();
}
File myCaptureFile = new File(ALBUM_PATH + fileName);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
}

㈢ android如何把byte數據存到內存中並轉為bitmap,求高手~~~~~~~~~~~~~~~~~~~~~~~~~~~

import java.io.File;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class MainAct extends Activity {
private ImageView img;
//圖片路徑
private String filepath = "/sdcard/sample.jpg";

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
img = (ImageView) findViewById(R.id.img);
File file = new File(filepath);
if (file.exists()) {
Bitmap bm = BitmapFactory.decodeFile(filepath);
//將圖片顯示到ImageView中
img.setImageBitmap(bm);
}
}
}

請參考

㈣ 在Android中如何將一張圖片轉換為byte數組

LZ,我比較好奇,你有木有試過將你得到的filebuffer再轉化成bitmap,看看它顯示出來的有木有變化?

㈤ Android Byte[]數組轉Bitmap時圖像失真,有些花 請問怎麼解決 急急急 !! 求大神

你把轉換前後的值都用System.out()輸出來,查看一下數值有沒有變化

㈥ android中如何將drawable中的圖片內容讀取出來並轉換為byte數據形式。 最好有代碼可以參考的

Bitmap bmp=BitmapFactory.decodeResource(r, R.drawable.icon);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, baos);
baos.toByteArray();

希望你能幫到你

㈦ android byte[]轉化成bitmap 發生了錯誤,要如何解決呢大神快來呀 高懸賞

建議使用BitmapFactory的其他decode方法,如果是網路讀過來的流,最好在本地存成文件緩存,然後通過decodeFileDescriptor方法就沒這種問題了。
你可以看一下這里 http://www.thinksaas.cn/group/topic/203384/,也碰到了類似的問題

㈧ android byte轉圖片問題,為什麼圖片沒有顯示,程序也沒有報錯

每種格式的文件都有不一樣的文件頭,擴展名之類的只是讓系統知道用何種軟體可以打開
至於文件格式是在文件頭裡面的,所以你的會是空

㈨ android 圖片以byte[]形式存入mysql資料庫,取出來後為空值。

這里需要的byte[]不是普通的,是:EntityUtils.toByteArray(entity)形式的。

㈩ Android 圖片以位元組流方式存入本地資料庫 怎麼弄 求高手指點啊

少年,資料庫有個類型是blob,可以用這個類型存儲,直接存儲位元組,步驟:
1.假設圖片欄位名Image,那麼設置Image為blob欄位
2.代碼中將bimageview轉換為位元組以後,用ContentValues中的values.put("Image",byte[]);然後或者是插入,或者是更新,用android的sqlite3中的操作就可以了
如果你看上面的後半部分不太懂,可以網路一下:android sqlite3 的增刪改查,就會看到裡面有具體的步驟了,就是利用ContentValues進行sql語句處理

熱點內容
三國志戰略版打9級礦什麼配置 發布:2025-05-15 11:41:29 瀏覽:952
安卓加速器怎麼關 發布:2025-05-15 11:38:16 瀏覽:464
密碼鎖壞了如何打開 發布:2025-05-15 11:30:19 瀏覽:837
怎樣增加共享文件夾連接數量 發布:2025-05-15 11:24:50 瀏覽:961
安卓如何關閉單應用音量 發布:2025-05-15 11:22:31 瀏覽:351
抖音電腦後台伺服器中斷 發布:2025-05-15 11:11:59 瀏覽:307
sql2008伺服器 發布:2025-05-15 11:03:27 瀏覽:306
我的世界pe伺服器創造 發布:2025-05-15 10:51:17 瀏覽:608
移動端打吃雞要什麼配置 發布:2025-05-15 10:48:16 瀏覽:756
我的世界哪五個伺服器被炸了 發布:2025-05-15 10:36:16 瀏覽:994