0
所以在開發過程中我已經掉在了地上:(我唯一的Android設備。一臺Nexus 7(第一代),現在在屏幕的1/5行不通了。不幸的是,對我來說我的小測試的應用程序利用了拍照後我不能按下「確認」按鈕(我用音量按鈕拍照)其他觸發拍照確認按鈕的方法?
1 /任何方式來改變我的代碼,以便不需要「確認」檢查和拍攝的照片是程序自動使用的照片?
2 /其他的方式來「確認」一個拍攝的照片?與取向
3 /移動相機控制,以另一側
代碼我用它來拍攝一張照片
public class TestCamera extends Activity {
private static final int CAMERA_REQUEST = 1888;
private ImageView imageView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.camera_layout);
this.imageView = (ImageView) this.findViewById(R.id.imageView1);
Button photoButton = (Button) this.findViewById(R.id.button1);
photoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent cameraIntent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST) {
// if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
}
}
}
任何提示,智能的建議?
我試圖您的建議和圖片採取,但它不返回,並顯示在imageview的形象。我的應用程序只顯示相機的用戶界面。我不知道我是否清楚,但由於放棄我的Android設備,我無法點擊確認按鈕。 INTENT_ACTION_STILL_IMAGE_CAMERA沒有確認按鈕,但是onActivityResult沒有被觸發。 – alex
用INTENT_ACTION_STILL_IMAGE_CAMERA它會自動保存圖片,所以我想你不會得到任何結果,你可以使用和設置你的imageView。 取決於你將如何使用你的應用程序,但你可以模擬觸摸事件,但使用ADB。按下按鈕確認照片。 「ADB殼輸入輕掃100 1000 100 10」 從座標X1,Y1到X2,Y2它將模擬的觸摸事件。 –