here's a start: put a "Hello World" message in a file named 'res/raw/helloworld' then try this:

        String message = ""; // get message from file
        Resources resources = getResources();
        InputStream xmlStream = resources.openRawResource( R.raw.helloworld );
        try {
            while ( true ) {
                 int b = xmlStream.read();
                 if ( b < 1 ) break; // EOF
                
message += String.valueOf( ( char )b );
            }
            xmlStream.close();
        }
        catch ( IOException e ) {
            Log.e( tag, "IOException'" + e.toString() );
        }
        Log.i( tag, "file message = " +
message );


Naveen Garg wrote:
Please let me know how to do file handling in Android. Some sample
code will be of great use to me.

Thanking in advance,

Naveen


  

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-no...
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to