Code Monkey Tries to Animate

As I mentioned that next step is adding animations. It’s a bit daunting to me to be honest. To start I skipped the video and downloaded the files Tree House provided. They were 22 Crystal Ball images where they ball basically lit up all mystical like and then faded back to the original. Once I saw that I thought about what I wanted Yoda to do. Speak the answer, obviously. I fired up Episode I and found a scene of Yoda talking. It was harder than I expected to find one of him close up and straight on, but I found one from the Council Chambers that should work well. That, as it turns out, was the easy part. Next I had to compile a number of screen shots from the film. Not too hard using VLC. Then cropping them all since I didn’t want the entire frame. THIS was difficult. I found a plugin for GIMP that allows batch editing of images so you can do the same thing to multiple images. Perfect! Except it only allows some basic fuctions, which while cool and time saving, still left me with a lot of work to do to get my 52 images ready to animate. I used the plugin to crop them all to the same size. Then I went through each one individually and applied an elliptical cutout around Yoda using the same X, Y coordinates so that he wouldn’t bounce around while animating. If anyone knows of an easier way to do things like this please let me know!

One of the Fifty-Two Yoda images I edited to make him Talk

Once I got those all the way I thought I wanted them, I finally fired up the next video to learn what to do with them. The files they included for download for the Crystal Ball animation included an XML file that I recreated for my yoda animation. I did that and followed the instructions for actually coding in the animation, and was greeted with the following:

Error message

My App has Stopped

That is pretty much where I am right now. I’m currently going over what little debugging I know to try and find the cause.

Code Monkey Makes Pretty Little Changes

Hello everyone! I continue to work through the Android Developing Adventure at Tree House. I’m on Stage 3 of building a simple app. It is titled “Pretty Little Things.” As you might have guessed we are prettying things up a bit. They added a crystal ball image to their background, but I found a nice image of Yoda looking wise to use.  A fair bit of what we covered here I have already learned, but doing it again will help to cement it in my mind and learning from a different source allows me to pick up a few new tips.

I’m running into more issues from using Android Studio as opposed to Eclipse. We went through adding a Theme (or rather changing from the default one) to the application in AndroidManifest.xml. They were able to simply pull up a nice interface that let them choose the Theme from a list of them by clicking on the Application tab at the bottom of the androidmanifest page, but I didn’t have that tab (or any of the ones shown in Eclipse) so I had to figure out where and how to add it manually to the xml code. Not a huge deal, but it was a bit of a setback for me. I wish they had covered both ways in the video, but I understand they want to keep it simple and if I had followed the first step in their videos I would be using the same IDE they are.

Theme Code in AndroidManifest.xml

If you look closely at the above image you can see we also set our main activity to only run in portrait mode. When we got our image added and changed the theme we ended up with no button or text on our screen. They were actually still there, but behind the image. We re-ordered the components in the component tree and could once more see everything. There was still a problem through. Our button was now right on top of the image. We moved it down to the bottom. Next we wanted to get the answer text to appear as if it was floating in the crystal ball (They did anyway, I followed along and made the words float over Yoda’s face). We added a Linear Layout (horizontal) and placed our Text view in it. To center our text view we added two blank views to either side of it in the Linear Layout and manipulated the weight of the three components. I could not find the blank views that they used in Android Studio so I used something called Spaces that were described as simple views. They did the trick the same as the views, but it appears they are from a later API and I might have to tweak that at some point. Once we got the Text View inside the Linear Layout lined up where they wanted it for their crystal ball, I moved mine down below Yoda’s Face. Before I’m finished with this I would like to add a something that says “Ask Yoda” above his image. Here is what the app currently looks like when you open it.

Opening Screen at this point

Background changed to Green since Yoda answered in the Affirmative

I was planning on continuing, but I just noticed the next part is on animation. I don’t feel up to tackling that right no so I’ll leave it here for now.