當前位置:首頁 » 安卓系統 » android文件byte

android文件byte

發布時間: 2023-09-19 02:06:49

1. android byte和byte的區別

估計題寫錯了哇byte與int的區別:
主要是存儲空間的大小和取值范圍不同。
byte佔用1個位元組存儲空間,取值范圍-128~127
int佔用4個位元組存儲空間,取值范圍-2的31次方~2的31次方-1

2. 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);
}
}
}

請參考

熱點內容
視頻軟體自動上傳 發布:2025-03-10 22:34:13 瀏覽:1000
pac自動代理腳本 發布:2025-03-10 22:34:09 瀏覽:319
我的世界國際版伺服器怎麼開創造 發布:2025-03-10 22:33:33 瀏覽:845
劇本的分鏡頭腳本 發布:2025-03-10 22:25:39 瀏覽:800
javachar轉string 發布:2025-03-10 22:24:58 瀏覽:164
手游吃雞配置低如何調順暢畫質 發布:2025-03-10 22:20:49 瀏覽:766
sql標數 發布:2025-03-10 22:20:49 瀏覽:656
如何用伺服器搭雲 發布:2025-03-10 22:20:48 瀏覽:268
linux線程間通信 發布:2025-03-10 22:15:02 瀏覽:853
python線程數量控制 發布:2025-03-10 22:14:28 瀏覽:451