title: How to change dynamically folder name file paths Android Studio?
body: <p>I need your help. 
  I'm starting to create an app, and I would save photos, videos, vocal memo etc. like a post/note and everything are part of this post.</p>
  
  <p>These multimedia files, will be saved in a folder, which name is a timestamp. On this way, every post/note is charaterized by the timestamp. The timestamp should update every time when I want to create a new post.</p>
  
  <p>I want to save my files by following this path:</p>
  
  <ul>
  <li>Name_app 
  
  <ul>
  <li>Timestamp
  
  <ul>
  <li>Pictures
  
  <ul>
  <li>Pictures1</li>
  <li>Pictures2</li>
  <li>...</li>
  </ul></li>
  <li>Videos
  
  <ul>
  <li>Video1</li>
  <li>...</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>Below my code.</p>
  
  <p>This is the code which create my Image File (and it look like to work):</p>
  
  <pre><code>private File createImageFile () throws IOException {
      // Create an image file name
      String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
      String imageFileName = "JPEG_" + timeStamp + "_";
      File root = new File(Environment.getExternalStorageDirectory().toString());
      File myDir = new File(root + "/Urban_stories_sharing/" + timeStamp + "/Pictures");
      if (!myDir.exists()) {
          myDir.mkdirs();
      }
      File image = File.createTempFile(
              imageFileName,  /* prefix */
              ".jpg",         /* suffix */
              myDir      /* directory */
      );
  
      // Save a file: path for use with ACTION_VIEW intents
      mCurrentPhotoPath = image.getAbsolutePath();
      return image;
  }
  </code></pre>
  
  <p>This is the code which start the activity:</p>
  
  <pre><code>public void goToCamera(View v) {
      getCameraPermission();
      Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
          File photoFile = null;
          try {
              isStoragePermissionGranted();
              photoFile = createImageFile();
          } catch (IOException ex) {
              // Error occurred while creating the File
          }
          // Continue only if the File was successfully created
          if (photoFile != null) {
              Uri photoURI = FileProvider.getUriForFile(this,
                      "com.example.andreacarubelli.urbanstoriessharing.fileprovider",
                      photoFile);
              takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
              startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
          }
      }
  }
  </code></pre>
  
  <p>I think that the problem is on <em>"Uri photoURI = FileProvider.getUriForFile(this,
                      "com.example.andreacarubelli.urbanstoriessharing.fileprovider",
                      photoFile);"</em></p>
  
  <p>This is the code of my path (and I don't know how to change it dynamically like this -> "Urban_stories_sharing/" + timeStamp + "/Pictures"):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;external-path name="my_images"
      path="Urban_stories_sharing/Pictures" /&gt;
  &lt;/paths&gt;
  </code></pre>
  
  <p>This is my provider in my Android Manifest:</p>
  
  <pre><code>&lt;provider
          android:name="android.support.v4.content.FileProvider"
          android:authorities="com.example.andreacarubelli.urbanstoriessharing.fileprovider"
          android:exported="false"
          android:grantUriPermissions="true"&gt;
          &lt;meta-data
              android:name="android.support.FILE_PROVIDER_PATHS"
              android:resource="@xml/file_paths"&gt;
  
          &lt;/meta-data&gt;
      &lt;/provider&gt;
  </code></pre>
  
  <p>Thank you so much.</p>