我想在文件夹

时间:2019-06-15 21:28:32

标签: android android-intent

下午好, 我正在创建一个项目,我需要一个活动,当用户拍照时,他可以将其存储到已经存在的文件夹中或创建新的文件夹。 因此,我有folderActivity,它包含文件夹项目和拍照活动。 我需要做的是,当用户拍照并按保存按钮时,将显示folderActivity,然后他选择其中一个文件夹并按“确定”,然后将picutres文件存储并显示到该文件中。 我希望我已经解释清楚了。 谢谢。

TakePictureActivity

public class AjouterImg_Fragment extends Fragment {
private ImageView imageView;
View view;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable 
ViewGroup container, @Nullable Bundle savedInstanceState) {
     view = 
 inflater.inflate(R.layout.fragment_ajouter_img_,container,false);
    imageView = (ImageView) view.findViewById(R.id.imageView4);
    takePicture();


    return view ;
}

private void takePicture()
{
    Intent takepic = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    File photoFile = null;
     try {
        photoFile = creerPhotoFile();
    }catch (Exception e){

    }
    startActivityForResult(takepic,1);
}

@Override
 public void onActivityResult(int requestCode, int resultCode, Intent 
 data)
{
        super.onActivityResult(requestCode,resultCode,data);
        Bitmap photo = (Bitmap) data.getExtras().get("data");
        imageView.setImageBitmap(photo);

}
private File creerPhotoFile() {
    Date date = new Date();
    String d = new SimpleDateFormat("dd/MM/yyyy").format(date.getDate());
    String heure = "" + date.getHours() +" : " +date.getMinutes();
    File dossier = null;
   return dossier;
  }
  }

folderActivity

enter image description here

0 个答案:

没有答案