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

Build a Self-Destructing Message Android App

First of all, thank you Ben Jakuben for an incredible class. It was very informative and nicely laid out.

Can someone explain why we have to do the entire section on ViewImageActivity but no need for videos? I am a little confused.

Thanks all.

3 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Good question! You can actually do both either way.

Often in Android you can use an Intent to let some other app perform an action for you. So with the video, we're "throwing it over the wall", so to speak, and letting one of the video players on the device display it. We could have, however, created another Activity, added a VideoView to the layout, and played it within the app.

Vice versa, we could have opened the image with some default image viewer on the device instead of viewing it in a new Activity.

I did the two different ways to show how easy it is to play a video in another player using an Intent, demonstrate how to use Picasso for images (really useful for all sorts of apps), and to demonstrate both methods.

Thanks Ben. Is there any open source video viewer like Picasso but for videoes? I am trying to implement so that user don't have to open up a video player - basically snapchat style.

Also I added a timer in the image view to show how many seconds they have left to view the image. Problem is sometimes the timer has started but the image has yet to be loaded from Parse.com. This results in less than 10 seconds to view the image. Is there a way to either 1. only start the timer once the image is loaded or 2. pre-load the image so you won't lose any time (I think this is how snapchat does it)? I think this is doable but have not done any extensive research yet.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

For the timer issue, you could try Picasso's version of into that includes a callback: http://square.github.io/picasso/javadoc/index.html Then in the onSuccess() method of the callback, start the timer.

For the video, check out the VideoView from the Android SDK: http://www.techotopia.com/index.php/Implementing_Video_Playback_on_Android_using_the_VideoView_and_MediaController_Classes

For open source video players, maybe Joe Steele could chime in. :)

Hey Ben Jakuben and Chiu Tong Tsang, sorry for the late reply! I don't know any good custom open source video players offhand, but the built in VideoView http://developer.android.com/reference/android/widget/VideoView.html is pretty capable. Mark Murphy has a sample of using it on GitHub.

https://github.com/commonsguy/cw-omnibus/tree/master/Media/Video