嗨,大家好我想從我的應用程序中使用設備中現有的相機應用程序的快照。我遵循了Android開發人員網站上提供的步驟。相機無法在Android應用程序中打開
public boolean onMenuItemSelected(int featureId, MenuItem item) {
// TODO Auto-generated method stub
switch(item.getItemId()){
case R.id.pic_take:
i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i, cameraData);
return true;
}
return super.onMenuItemSelected(featureId, item);
}
其次是這樣的:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == cameraData && resultCode == RESULT_OK){
Bundle extras = data.getExtras();
bmp = (Bitmap) extras.get("data");
cameraView.setImageBitmap(bmp);
}
}
我也確信,我的仿真器具有正面和背面啓用攝像頭。
請不要關閉此問題。問題是當我選擇相機沒有打開的選項時,活動日誌中也沒有錯誤。無論是做應用程序崩潰: 當我點擊該選項,我在活動日誌中得到的唯一信息是:
04-01 17:44:16.665: I/Choreographer(1227): Skipped 48 frames! The application may be doing too much work on its main thread.
請幫我解決這個問題。
讓我知道,如果它worket真實設備,如果你已經嘗試過了:) –