List of usage examples for android.os Environment DIRECTORY_PICTURES
String DIRECTORY_PICTURES
To view the source code for android.os Environment DIRECTORY_PICTURES.
Click Source Link
From source file:com.uberspot.storageutils.StorageUtils.java
public File getPictureDirectory(String albumName) { return new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), albumName); }
From source file:com.kayzook.bracediary.BaseActivity.java
private File getOutputPhotoFile() { File directory = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), getPackageName());// w ww. j a v a 2 s .co m if (!directory.exists()) { if (!directory.mkdirs()) { return null; } } String timeStamp = new SimpleDateFormat("yyyMMdd_HHmmss", Locale.US).format(new Date()); return new File(directory.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); }
From source file:net.jongrakko.zipsuri.activity.PostReviseActivity.java
private void takeImage() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); takeFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Zisuri_tmp_" + System.currentTimeMillis() + ".jpg"); Uri saveUri = Uri.fromFile(takeFile); intent.putExtra(MediaStore.EXTRA_OUTPUT, saveUri); // set the image file name startActivityForResult(intent, TAKE_PHOTO_FOR_AVATAR); }
From source file:com.mgtv.qxx.ttsdemo.Camera2BasicFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mExtenSd = QxxExec.getExternalSDCardPath(); mFile = new File(mExtenSd + "/" + Environment.DIRECTORY_PICTURES, "/pic.jpg"); }
From source file:com.mocap.MocapFragment.java
public void SaveOBJ(Context context, MyGLSurfaceView glview) { Log.i(TAG, "DIR: "); float sVertices[] = glview.getsVertices(); FileOutputStream fOut = null; OutputStreamWriter osw = null; File mFile;/* w ww. jav a 2 s .c om*/ if (Environment.DIRECTORY_PICTURES != null) { try { mFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "mocap.obj"); Log.i(TAG, "Long Vertices: " + sVertices.length); fOut = new FileOutputStream(mFile); osw = new OutputStreamWriter(fOut); osw.write("# *.obj file (Generate by Mocap 3D)\n"); osw.flush(); for (int i = 0; i < sVertices.length - 4; i = i + 3) { try { String data = "v " + Float.toString(sVertices[i]) + " " + Float.toString(sVertices[i + 1]) + " " + Float.toString(sVertices[i + 2]) + "\n"; Log.i(TAG, i + ": " + data); osw.write(data); osw.flush(); } catch (Exception e) { Toast.makeText(context, "erreur d'criture: " + e, Toast.LENGTH_SHORT).show(); Log.i(TAG, "Erreur: " + e); } } osw.write("# lignes:\n"); osw.write("l "); osw.flush(); ; for (int i = 1; i < (-1 + sVertices.length / 3); i++) { osw.write(i + " "); osw.flush(); } //popup surgissant pour le rsultat Toast.makeText(getActivity(), "Save : " + Environment.DIRECTORY_PICTURES + "/mocap.obj ", Toast.LENGTH_SHORT).show(); //lancement d'un explorateur de fichiers vers le fichier crer //systeme des intend try { File root = new File(Environment.DIRECTORY_PICTURES); Uri uri = Uri.fromFile(mFile); Intent intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); intent.setData(uri); // Verify that the intent will resolve to an activity if (intent.resolveActivity(getActivity().getPackageManager()) != null) { Log.i(TAG, "intent pk: "); getActivity().startActivityForResult(intent, 1); } } catch (Exception e) { Log.i(TAG, "Erreur intent: " + e); } } catch (Exception e) { Toast.makeText(context, "Settings not saved", Toast.LENGTH_SHORT).show(); } finally { try { osw.close(); fOut.close(); } catch (IOException e) { Toast.makeText(context, "Settings not saved", Toast.LENGTH_SHORT).show(); } } } else { Toast.makeText(context, "Pas de carte ext", Toast.LENGTH_SHORT).show(); } }
From source file:net.jongrakko.zipsuri.activity.PostReviseActivity.java
private void takeVideo() { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); takeFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Zisuri_tmp_" + System.currentTimeMillis() + ".mp4"); Uri saveUri = Uri.fromFile(takeFile); intent.putExtra(MediaStore.EXTRA_OUTPUT, saveUri); // set the image file name intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high startActivityForResult(intent, TAKE_VIDEO_FOR_AVATAR); }
From source file:net.jongrakko.zipsuri.fragment.MyPublicQuestionFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK && requestCode == UCrop.REQUEST_CROP) { File cropFile = new File(UCrop.getOutput(data).getPath()); mAnswerModelPhoto.setImage0(cropFile.getAbsolutePath()); ServerManager.uploadPublicAnswer(new ServerManager.OnServerListener<Void>() { @Override//from w w w.ja va2 s. com protected void onSuccess(Void data) { getParentActivity().refreshData(); ProgressManger.showToast(" !"); } }, mAnswerModelPhoto); } else if (resultCode == Activity.RESULT_OK && requestCode == PICK_PHOTO_FOR_AVATAR) { UCrop.of(data.getData(), Uri.fromFile( new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), System.currentTimeMillis() + ".jpg"))) .withMaxResultSize(1920, 1920).start(getContext(), this); } else if (resultCode == Activity.RESULT_OK && requestCode == TAKE_PHOTO_FOR_AVATAR) { UCrop.of(Uri.fromFile(takeFile), Uri.fromFile( new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), System.currentTimeMillis() + ".jpg"))) .withMaxResultSize(1920, 1920).start(getContext(), this); } else if (resultCode == UCrop.RESULT_ERROR) { final Throwable cropError = UCrop.getError(data); Log.d("mox", "croperror" + cropError.toString()); } }
From source file:edu.sfsu.csc780.chathub.ui.ChannelActivity.java
private File createAudioFile() throws IOException { // Create an audio file name String timeStamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date()); String audioFileNamePrefix = "audio-" + timeStamp; File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); File audioFile = File.createTempFile(audioFileNamePrefix, /* prefix */ ".3gp", /* suffix */ storageDir /* directory */ );/*from ww w . jav a 2 s . co m*/ return audioFile; }
From source file:com.paramedic.mobshaman.fragments.AccionesDetalleServicioFragment.java
protected File createImageFile() throws IOException { // Create an image file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); File image = File.createTempFile(imageFileName, /* prefix */ ".jpg", /* suffix */ storageDir /* directory */ );/*from w w w. j a v a2 s. c o m*/ // Save a file: path for use with ACTION_VIEW intents DetalleServicioActivity activity = (DetalleServicioActivity) getActivity(); activity.setCurrentPhotoPath("file:" + image.getAbsolutePath()); return image; }