我真的需要这个代码,我在互联网上搜索了3个小时,但我找不到一个完整而简单的代码,我测试了很多代码,但有些没有用,有些不好,请帮我一个完整而简单代码,谢谢编辑:我有选择图像的代码,但请给我一个完整的代码,我在标题中说的所有事情,因为我不能像代码.
btn_choose.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"),SELECT_PICTURE);
alertDialog1.dismiss();
}
});
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_PICTURE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
selectedImagePath1=selectedImagePath;
System.out.println("Image Path : " + selectedImagePath);
image_capture1.setImageURI(selectedImageUri);
}
Run Code Online (Sandbox Code Playgroud)