Android Uri to Filesize

Possible Duplicate:
Android: Get the size of a file in resources?

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. Is there an easier/conventional way to solve this issue?

  • How to compile a C program for Genymotion (Android x86)
  • How to remove call logs from android programmatically?
  • Custom attrs parameter used in styles.xml
  • To draw an Underline below the TextView in Android
  • How to quit an application programmatically through button click
  • Multiple fixtures on one body or multiple bodies?
  • Thanks

    Related posts:

    How to change size of title's text on Action Bar?
    Adding custom view to a toolbar
    Unregister a device from GCM using registration Id in Android
    Android Studio - no debuggable applications
    Loading large images without OutOfMemoryError
    Documentation of available Ant tasks for Android?
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.