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

請參考

熱點內容
如何取消酷派手機密碼鎖屏 發布:2023-10-04 18:36:58 瀏覽:854
windows遠程腳本 發布:2023-10-04 18:16:41 瀏覽:558
如何設置優先伺服器 發布:2023-10-04 17:58:35 瀏覽:908
php數字字元串相加 發布:2023-10-04 17:54:01 瀏覽:120
伺服器地址後面8090 發布:2023-10-04 17:12:24 瀏覽:249
蝴蝶形演算法 發布:2023-10-04 16:48:40 瀏覽:706
王者榮耀安卓怎麼移區 發布:2023-10-04 16:20:25 瀏覽:594
python安裝環境配置 發布:2023-10-04 15:53:58 瀏覽:595
c語言怎麼取整數 發布:2023-10-04 15:32:25 瀏覽:432
設置微信存儲空間 發布:2023-10-04 15:30:44 瀏覽:905