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

請參考

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