Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Data Persistence File Storage Writing to Internal Storage

Harry James
Harry James
14,780 Points

Method that should be in the Teacher Notes

Evan talks about the copyFile() method that should be in the Teacher Notes however, it seems as though it isn't!

Here's the method for easy copying/pasting for any students that want to use it:

    private static void copyFile(InputStream in, OutputStream out) throws IOException {
        byte[] buffer = new byte[1024];
        int read;
        while((read = in.read(buffer)) != -1) {
            out.write(buffer, 0, read);
        }
    }

Hope it helps! :)

Jacob Bergdahl
Jacob Bergdahl
29,118 Points

Thank you, Harry. I think that was pretty sloppy of Evan to not make sure that it was there. Especially since it's been at least five months, probably more, since.

Sexual Potatoes
Sexual Potatoes
12,051 Points

Thanks. This course is a mess.

4 Answers

Harry James
Harry James
14,780 Points

Marking as resolved

Thank you for posting this. Not only is it not posted in the teacher notes, the video also runs off the screen and you can't see the { you need... but you can't get to the treehouse community forum on the app on the phone, so I wound up finding the code on Stack Overflow.

Ni Yao
Ni Yao
3,852 Points

2 years later and the notes still haven't been fixed.

While it is resolved, Treehouse needs to fix it as having every single person who pass through here spend even 15 secs to find it is wasting a huge amount of cumulative human hours.

This course is a mess.

Susan Jensen , looking the code up to find out what it you need is a learning experience itself, congratulations. You will find yourself doing that plenty of times during the process of coding apps.

peter doherty
peter doherty
6,690 Points

Thanks, Harry James.

Why hasn't this method been added to the teacher's notes, Treehouse?