I need help for this. The path for my URL is something like this
But i when i use the below codes it shortens it to
27827.epub.images
I need fileName to become
27827.epub
without the .images
String path = url.getPath();
String idStr = path.substring(path.lastIndexOf('/') + 1);
String fileName = idStr;
InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream("/sdcard/" + fileName);
To give a complete answer, you need to define the possible formats for the URL. If you can assume it always ends with ".images", simply cut that part off,
If it’s the case that you always want to cut off the trailing "." and anything after it, you can do,