Android照相與相片

2021-08-31 19:43:49 字數 1328 閱讀 9583

public class shootmainactivity extends activity implements onclicklistener 

private void initui()

@override

public void onclick(view v)

} // 拍照的**儲存位置

public string getphotodir()

// 拍照獲取

protected void dotakephoto()

// 請求gallery程式

protected void dopickphotofromgallery()

// 封裝請求拍照的intent

public static intent getphotointent(file f)

// 封裝請求gallery的intent

public static intent getphotoalbumintent()

protected void onactivityresult(int requestcode, int resultcode, intent data)

imagedata();

} private void imagedata()

} }// 將uri轉成bitmap

private bitmap geturi2bitmap(uri urito) catch (exception e)

// 將位元組陣列轉換為imageview可呼叫的bitmap物件

bitmap mbitmap = getpicfrombytes(mbuffer, null);

return mbitmap;

} // 將位元組陣列轉換為imageview可呼叫的bitmap物件

public static bitmap getpicfrombytes(byte bytes,

bitmapfactory.options opts)

// 將內容解析成位元組陣列

public static byte readstream(inputstream instream) throws exception

byte data = outstream.tobytearray();

outstream.close();

instream.close();

return data;

} private void imageuri(intent data)

public void imagebytedata(intent data)

}

批處理 從數碼相片得到照相時間

echo off setlocal enabledelayedexpansion del f q picture.txt 2 nul cls echo 正在處理 a set final null if final null set a times 0 for f delims i in findst...

android新版本下開啟相簿取出相片新姿勢

intent intent new intent intent.action get content intent.settype image startactivityforresult intent,result image 首先是開啟相簿,這沒什麼好說的,呼叫系統程式,開啟image型別的檔案...

android 呼叫系統照相機和攝像機

檢視系統照相機原始碼,找到清單檔案檢視 檢視意圖過濾器,action 是android.media.action.image capture category是 android.intent.category.default 獲取intent 物件,通過 new出來 呼叫intent 物件的seta...