Android Uri to Filesize?

You can get the size of the file in bytes thus: File f = new File(uri.getPath()); long size = f.length().

File expects java.net. URI, but I have andorid.net. Uri – Soccertrash Mar 10 at 18:01 1 This SO post shows how to convert between the two: stackoverflow.Com/questions/559902/… – Kurtis Nusbaum Oct 5 at 19:33.

I want to upload a file to a WebServer. To show the progress of the upload I need to know the complete size of the file. Since I have only the Uri of the file (got it from an Intent), I have no chance to get at the file's size.

My workaround is to open an InputStream and count the bytes that are read on this InputStream. But this is circuitous.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions