button image = (button) findviewbyid(r.id.image);
//呼叫照相機
image.setonclicklistener(new onclicklistener()
@suppresswarnings("deprecation")
@suppresslint("sdcardpath") @override
protected void onactivityresult(int requestcode, int resultcode, intent data)
new dateformat();
//根據系統時間得到名
system.out.println("名字*****"+name);
bundle bundle = data.getextras();
//bitmap是用於處理由畫素資料定義的影象的物件。
bitmap bitmap = (bitmap) bundle.get("data");// 獲取相機返回的資料,並轉換為bitmap格式
fileoutputstream output = null;
file file = new file("/sdcard/myimage/");
file.mkdir(); //建立資料夾
string filename = "/sdcard/myimage/"+name;
try catch (exception e) finally catch (ioexception e) }}
呼叫系統相機相簿
跳轉至系統相簿 param activity 活動例項 param requestcode 請求碼 public static void startsystemalbumforresult activity activity,int requestcode 呼叫系統相機 param activity...
iOS 呼叫系統相簿相機
actionsheet的方法在8.3之後就被取代了,下面介紹目前比較新的方法 1 info.plist檔案寫訪問授權 nsphotolibraryusagedescription 請求訪問相簿 nscamerausagedescription 請求訪問相機 2 這一步就不解釋了,當用到uiimage...
Android呼叫系統前置相機拍照
intent intent new intent mediastore.action image capture intent.putextra camerasensortype 2 呼叫前置攝像頭 測試,發現不正確,並不能直接開啟前置攝像頭,開啟的是上次使用的攝像頭。正確方法是 intent in...