• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

renaming an image file on sd card

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have to change the name of a jpg file , for that i have written the following code

sdcard = Environment.getExternalStorageDirectory();
from = new File(sdcard,imagePath.substring(8).toString());
to = new File(sdcard,"/DCIM/RoseVille_"+Info.getText()
+"_"+Amount.getText()+"_"+timeStampFormat.forma t(n ew Date())+".jpg");

if(from.renameTo(to)==true)
{
/// if renamming is successfull;
}

this code creates a new file with the required name while the file which i wanted to change is still their on sd card , if i remount the sd card then the old file gets deleted and the renamed file remains their.

so my problem is how to rename the file without remounting the sd card

thanks and regards
focode
 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you try the following on emulator, after you've renamed your file in code, run MediaScanner from dev tools, and see if the changed name is getting reflected?
 
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic