Basic file input / output tutorial

by superjet » Thu, 12 Mar 2009 10:22:23 GMT


Sponsored Links
 I'm new to Java/Android, can anyone recommend a tutorial on android
that introduces reading and writing flat files?

sj

ps, if this is a double post, sorry, but I posted several hours ago
and it seems it never went through.

--~--~---------~--~----~------------~-------~--~----~



Basic file input / output tutorial

by superjet » Thu, 12 Mar 2009 22:16:11 GMT


 Sorry, this is a duplicate:


Sponsored Links


Basic file input / output tutorial

by Joseph Arceneaux » Fri, 13 Mar 2009 01:57:57 GMT


 I'm not aware of a tutorial, but it's pretty easy - here's some code that
reads in a file.  Check out the File and File*Stream classes.
Joe

        String path = "/data/data/com.company.app/files/foo.jpg";
        File f = new File (path);
        if (f.exists() && f.canRead ())
        {
            try
            {
                FileInputStream is = new FileInputStream (f);
                int size = is.available();
                contents = new byte[size];
                int got = is.read (contents);
                if (got != size)
                {
                    Log.e ("File", f.getName () + ": expected " + size + ",
got " + got + " bytes.");
                    bm = null;
                }
                else
                    bm = BitmapFactory.decodeByteArray (contents, 0, size);
            }
            catch (Exception e)
            {
                Log.e ("FileSave", e.toString());
            }






--~--~---------~--~----~------------~-------~--~----~



Basic file input / output tutorial

by superjet » Sun, 15 Mar 2009 13:13:21 GMT


 Thanks man! I'll give this a shot tomorrow night.





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. System Themes?

I am looking to eventually create a Star Trek-style LCARS UI for the
whole G1-Android experience... the first step is to change the basic
colors of the home screen.
<a href="http://s28.photobucket.com/albums/c233/femonky/?
action=view&current=PROTOLCARS.jpg" target="_blank"><img src="http://
i28.photobucket.com/albums/c233/femonky/PROTOLCARS.jpg" border="0"
alt="Proto LCARS"></a>
Any ideas on what I at least need to read to come closer to this?
I've been out of college for 7 years and my Java coding is HORRIBLY
rusty!

Gassho,
XV

--~--~---------~--~----~------------~-------~--~----~

2. android:apiKey in m5-r15

How I can use mapview in Android m5-r15 if don't exists the parameter
android:apiKey ?

I don't have much time to translate my code to the last version because I
need to submit it to graduate.



*Cassiano Valle Tartari - www.cassianotartari.eng.br*

   *- Tcnico em Informtica pelo Colgio Tcnico Industrial - CTI*[image:
   CTI] *- Graduando em Engenharia de Computao pela Universidade Federal
   do Rio Grande - FURG*[image: FURG]

--~--~---------~--~----~------------~-------~--~----~

3. Messenger on UK G1

4. Why does "My Location" crash LocationManagerService?

5. SlideME: Sam 2.1 Release

6. Android Market - Comment Spam (Youtube-Style-Solution ?)

7. Android embedded hardware