當前位置:首頁 » 安卓系統 » 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);
}
}
}

請參考

熱點內容
app什麼情況下找不到伺服器 發布:2025-05-12 15:46:25 瀏覽:713
php跳過if 發布:2025-05-12 15:34:29 瀏覽:466
不定時演算法 發布:2025-05-12 15:30:16 瀏覽:129
c語言延時1ms程序 發布:2025-05-12 15:01:30 瀏覽:163
動物園靈長類動物配置什麼植物 發布:2025-05-12 14:49:59 瀏覽:732
wifi密碼設置什麼好 發布:2025-05-12 14:49:17 瀏覽:147
三位數乘兩位數速演算法 發布:2025-05-12 13:05:48 瀏覽:396
暴風影音緩存在哪裡 發布:2025-05-12 12:42:03 瀏覽:539
access資料庫exe 發布:2025-05-12 12:39:04 瀏覽:627
五開的配置是什麼 發布:2025-05-12 12:36:37 瀏覽:363