Text file name limit

My app need to save a text file, letting the user customize the file name of that file. Can I know what is the maximum file name length in android, and any special characters are not allowed?

I can only search file name length of Window but not android.

I don’t think there is any limit for filename.

You can use all characters if you use correct charset.Probably some characters are not allowed in utf-8 (most common charset)

1 Like

2 years ago, Samsung had a limit of 50 characters. I don’t know if it still like this. Either way Android itself don’t seems to have a limit, it was just Samsung


Thank you all!

I don’t think so

Soo stick to 255 bytes


About how many words is 255 bytes?
Like how to check if the text bytes is greater than 255 bytes?

Try to find the character that takes the most space (W). Make a text document full of those characters. Once the text file size reaches 255 bytes count the characters.

1 Like

If I can check then I don’t need to count. :stuck_out_tongue_winking_eye:

Why W


Google says so :stuck_out_tongue:

@Mateja I read the thread you posted. It says this:
About the maximum length: Since I couldn't find anything specific to Android, and since java does not restrict the length of a file name it works with (As you can see [here](https://stackoverflow.com/questions/4512742/does-java-io-have-a-maximum-file-name-length)), I'd say the maximum length is like the most widely used limit, which is 255 bytes.

So the conclusion is that there is no limit but it is suggested to use 255 normal characters or bytes.


Thx for your great conclusion. :blush:

1 Like

Welcome :grinning:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.