當前位置:首頁 » 安卓系統 » 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語句處理

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:712
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:975
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:686
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:837
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:744
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1085
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:314
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:194
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:882
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:840