Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6133715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:15:50+00:00 2026-05-23T17:15:50+00:00

in my application i create a temporary file this way File tmp = File.createTempFile(TEST_,

  • 0

in my application i create a temporary file this way

File tmp = File.createTempFile("TEST_", null, getFilesDir());

this resolves in a file that toURI()zed corrisponds to something like

/data/data/it.lorenzoff.test/files/TEST_XXX.tmp

In certain circumstances, i’d like to move this file permanently on sdcard but this code

dest = new File("/sdcard/permanentFile");
tmp.renameTo(dest);

never works.

I’m already using these permissions

<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

but renameTo continue returning false.
What i’m doing wrong?

Thanks in advance

L.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:15:51+00:00Added an answer on May 23, 2026 at 5:15 pm

    The explanation can be found in documentation for File:

    Many failures are possible. Some of the more likely failures include:

    • Write permission is required on the directories containing both the source and destination paths.
    • Search permission is required for all parents of both paths.
    • Both paths [must] be on the same mount point. On Android, applications are most likely to hit this restriction when attempting to copy between internal storage and an SD card.

    In this case source and target file paths point to different mount points (these two mount points even have different file system). You only option is to manually copy the file to sdcard and then delete the file from internal storage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How should I create application wide utility/manager classes that read settings from the database?
I know that in a standalone application I create one of the application context
In VS2008, I go to File/New/Project, select ASP.NET Web Application and create a new
If I create an application on my Mac, is there any way I can
I need to create an ASP.NET 2.0+ web application that allows the user to
Here is my situation: I have an application that use a configuration file. The
I want to have an application that has a permanent database file(on a hard
I've written an application that uses the WIN32 api to create a temporarily directory
My rails application runs on a Ubuntu server machine. I need to create temporary
When deploying or starting websphere aplication server this happens : Failed to create temporary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.