當前位置:首頁 » 安卓系統 » 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-09-11 12:10:34 瀏覽:554
java線程應用 發布:2025-09-11 11:58:29 瀏覽:799
圓形演算法 發布:2025-09-11 11:57:51 瀏覽:179
怎麼買大陸域名香港伺服器 發布:2025-09-11 11:33:41 瀏覽:581
360提高上傳速度慢 發布:2025-09-11 11:28:39 瀏覽:722
android源碼版本號 發布:2025-09-11 11:16:23 瀏覽:906
黑月編譯器編譯不了帶支持庫的 發布:2025-09-11 11:09:47 瀏覽:57
nba2k22安卓在哪裡預約 發布:2025-09-11 11:05:58 瀏覽:491
查看qq聊天記錄有密碼如何查看 發布:2025-09-11 11:02:39 瀏覽:644
ios緩存webview 發布:2025-09-11 10:40:58 瀏覽:93