android - Folder on phone not showing in Windows PC -


i writing app create folder on nexus 5 , write text file inside folder.

the above part working fine. writting using following code:

creating folder:

file sdcard1 = environment.getexternalstoragedirectory();         file dir = new file(sdcard1.getabsolutepath() + "/smsapp");         if (dir.isdirectory())          {             string[] children = dir.list();             (int = 0; < children.length; i++)              {                 new file(dir, children[i]).delete();             }         }          file sdcard = environment.getexternalstoragedirectory();         directory = new file (sdcard.getabsolutepath() + "/smsapp");         directory.mkdirs(); 

and writing string text file.

public void writetotext(string texttosave)     {         file sdcard = environment.getexternalstoragedirectory();         file logfile = new file(sdcard.getabsolutepath() + "/smsapp" + "/smsrawdata.file");         if (!logfile.exists())         {             try             {                 logfile.createnewfile();             }              catch (ioexception e)             {                 e.printstacktrace();             }         }         try         {             bufferedwriter buf = new bufferedwriter(new filewriter(logfile, true));              buf.append(texttosave);             buf.newline();             buf.close();         }         catch (ioexception e)         {             e.printstacktrace();         }     } 

text file showing on phone when trying access same folder on phone can't see folder @ all.

i thought same other app on play store creates folder gets created , can see them on windows explorer.

am doing wrong in code part not show on computer show on phone. using es file explorer see files on phone.

please let me know if else having same problem.

thanks!

your pc communicate media store files. not directly sdcard or external memory. if media store not know file pc can not see it. forgot tell store created file. every new file should invoke media scanner file. not first 1 happens problem has been reported many times. need add few lines of code find searching site invoking media scanner on new file. if switch off/on device file known too.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -