Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: File in android

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Thanked 0 Times in 0 Posts

    Default File in android

    Hi everyone!! I need to access a txt file from android. The problem is that I need to use the class “File” because I need to know the file size (lenght() method) .

    The only solution I have found in the web is

    InputStream is = getResources().getAssets().open("myfile.txt");

    But InputStream does not have the method “lenght”, and I can't know the size of the file.

    How can I get an object “File” from android? Or convert an InputStream to a file?

    Thank you very very much

  2. #2
    Join Date
    Jan 2012
    My Mood
    Thanked 0 Times in 0 Posts

    Default Re: File in android

    have you tried length()? Im not sure its in there but you seem to misspell length consistently.

Similar Threads

  1. Android Development
    By bgroenks96 in forum Java ME (Mobile Edition)
    Replies: 3
    Last Post: August 30th, 2013, 10:03 PM
  2. College project: XML file from PC to Android
    By StudioGilliam in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: March 1st, 2012, 05:42 AM
  3. Events in Android
    By Nesh108 in forum Android Development
    Replies: 3
    Last Post: February 29th, 2012, 10:49 AM
  4. Hello World Android App
    By TP-Oreilly in forum Android Development
    Replies: 6
    Last Post: January 22nd, 2012, 08:01 PM
  5. how to add adt(android plugin) to eclipse from zip file ???
    By mahdi in forum Android Development
    Replies: 2
    Last Post: July 9th, 2011, 02:32 PM