title: Hide a file from SD card
body: <p>Hi I have created a folder in sd card holding a db as below</p>
  
  <pre><code>public Databasehandler(Context context) 
  {
      //super(context, DATABASE_NAME, null, DATABASE_VERSION);
      super(context, Environment.getExternalStorageDirectory()+ File.separator + "MyAppFolder"+ "/"+DATABASE_NAME, null, DATABASE_VERSION);
  }
  </code></pre>
  
  <p>Now, I am trying to hide this file so that it is not accesible. I tried the below code.</p>
  
  <pre><code> final String NOMEDIA_FILE = ".nomedia";
  
      path = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separator + "MyAppFolder" );
      path.mkdirs();
  
      file= new File(path,NOMEDIA_FILE);
      if (!file.exists()) 
      {
          try 
          {
              file.createNewFile();
              Log.e("NOMEDIA_FILE"," ");
          }
          catch (IOException e) 
          {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>But, this is not working. Not sure how to hide the file in SDcard . Please Help. Thanks!</p>