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.

Team Tree House?

I’ve started using since reading about it for the first time yesterday. I’m not sure how far I’ll be able to go with it because it is actually a paid program (service?) and I don’t have spare funds at the moment. I was however able to score a free first month through a promotion I found, so I’ll try to make the most of it. It is way more interactive than simply watching videos. It includes quizzes, and coding challenges that let you know if you got it right as well as the usual follow along videos I have come to know from mybringback and other sources.

Mike the frog, Team Tree House’s mascot

I started at the beginning of the Learn Android Adventure and am just working my way through it. I have learned a few new things. They recommend always using scale-independent pixels (sp) which I think I agree with. They will scale based on the size of the screen as well as the user’s font setting for the device. If I understand correctly using density pixel would stay the same size no matter what the user had the device’s font to set to. This would potentially cause your app to be unusable by someone with poor eyesight who had the font set to large so they could read it. That would be bad.

I’m also learning about arrays! Arrays can be used to store a number of different values from one data type. You tell the computer that it is an array by using square brackets after the data type (String[]) and then open curly braces to start your list of values. That was a terrible description so I’ll just include a picture of my code for the app tree house has me making. Actually, I’m altering the app a little. They are making a Crystal Ball app, and I’m not into that, at all. So I am making an Ask Yoda app.

My First Array in Java/Android

I was excited to cover if statements because mybringback hadn’t touched on them yet and I remembered them being such a big part of the course I took on Python.  It seems like they will be a fairly big part of Android dev as well, and I imagine of any type of programming. Before we made our array as seen above we simply had 3 possible answers: Yes, No and Maybe. We had a random number generator (Which is also new for me in Android) that could give us 0, 1 or 2 when we ran it. We used this with an if statement to assign 0 to Yes, 1 to No and 2 to Maybe. This worked great and was a simple way to introduce if statements. When we added are array we pulled that if statement out. I have added a new one to my code though that changes the background color dependent on whether the answer was positive, negative or neutral.

If Statement to change the Background text

I’ll stop there for now. I’m really liking Team Tree House. I really think I’d like to continue using it after this first free month runs out. I’m going to see if I can work it into my budget somehow. That said, if you are interested in learning anything in their library please consider using my referral link. It will get you 50% off your first month and I’ll get $5 off my next month.

Learning Adventure 

Some of the things you can learn

Here’s my referral link:



A Small Update

I had part of a post written up a few weeks ago, but I guess it didn’t save. Been a while… I pretty much haven’t done any work on coding in the past month, but motivation struck again, so here I am. I keep ideas for things I want to code or additions I want to make for the apps I have planned to make, but I don’t know how to implement them. I previously said I would be updating twice a week, but I’m going back on that. It felt like a job at that stage and when something came up that meant I couldn’t meet my self imposed deadline, I got discouraged. I’m learning to code FOR FUN, so from now on updates will come when they come.

So here I am. Back at MyBringBack going over tutorials.

The first tutorial I checked out was Number 18 on creating a scroll view. Nothing real magical here. It was pretty basic. I’ll just put up a picture of the code and the result.

The code for Scroll View (Both the linear layout and scroll view tags are closed after a series of buttons

The scroll in Action, although a bit hard to show in a still image

Dur, Spelling is Hard

Hey guys, Another weekend of lots of gaming and near enough sleep, but I got back at coding Sunday afternoon. Started out with lesson 15 over at MyBringBack. In this lesson we finished up the current activity we’ve working on. We made the Radio Groups for Gravity and Typeface work. We fleshed out the onCheckedChanged method we created as a stub last week. I’m not really sure how to walk through this, but I’ll post a picture of my code.

Code that makes our Radio Buttons work

Let me take a stab at this… Let’s look at the first case (rbLeft). In case our Left Radio Button is checked, set the Gravity to Gravity.LEFT. That will make the text align to the left side of the screen. Well, that wasn’t too bad. But it get’s more interesting when we get to the Typeface ones, so let’s look at rbNormal and see if we can make sense of it. In case our Normal Radio Button is checked set Typeface to Normal. That is what it does, but does all this mean? “Typeface.defaultFromStyle(Typeface.NORMAL), Typeface.NORMAL” Why do we need all that instead of just something like Typeface.NORMAL? I’m not sure. Hopefully it all becomes clear at some point in the future. In the mean time let’s take a look at our activity in action.

Our text with Typeface set to Normal and Gravity to Center

Typeface set to Bold and Gravity set to Right

Lesson 16 had us working on the menu. You might have noticed that this blog post is really late. Well that is because the lesson burned me out a bit. It all seemed simple enough. And in reality it was. But my inability to spell hurt me. Worse than that my inability to notice my spelling mistake for the two hours + I spent staring at my code to try to solve my issue. I ended up sending my who project to a friend who knows more about coding than me and he found my error (Thanks Glen!!!). By that time I was pretty discouraged and spent the week gaming instead of coding. Ready to get back at it now.

Code Monkey Works with some Java

Hello Everyone!

Been busy the last couple days with some boring stuff like lawn care (I was trying to grow a jungle, but my wife didn’t like that plan). I only managed to get one lesson in. It was Lesson 14 and was all about using the getText() and setText() methods. There really isn’t a whole lot to talk about here. We set up a few more ids on our radio groups from lesson 13 and then we started setting up the methods to make them work. We set up textOut to output text, or at least we started to. I don’t think we finished anything yet. We set up textIn to get the text we will output. We also set up our radio groups so we can get them to do stuff later on.

Our code after lesson 14

My First App

I started working on the layout of my sound effects app. I’ve decided I will do as much of it as I can on my Nexus 7 using AIDE.  AIDE is a Java IDE that can build and compile apps right on your android device. I highly suggest checking it out if you make apps at all. I see myself mostly using it just to tweak or make small changes later on, but I thought I’d see if I can build a basic app with it. As I said I’ve only just started building my layout. If I can get my wireless keyboard running it’ll be much faster sailing. Stupid batteries! So far I have got one layout file started with 4 buttons across the top that I used a Horizontal Linear Layout and weight to appear as tabs at the top of the screen. I plan to add 3 columns of 4 or 5 buttons each. I tried to add a Text View under the tab buttons, but I couldn’t get it to appear properly. I am pretty sure I need to give it it’s own Linear Layout to get it to work. I’ll try to do that tonight.

Sorry this post is so short. Hopefully

Monkey Learns More About Layouts

After a weekend of Wedding Anniversary celebrations and late night gaming sessions, I was happy to get back to coding!

I had a little bit of trouble getting back into mybringback’s lessons. What should have been the next lesson was talking about things that we hadn’t done yet. Where did that radio button come from? How did he make those two text views appear side by side like that? After I clicked through the lesson pages a few times, I determined that lesson 12 was in fact missing. I tracked it down on his YouTube playlist. What’s really funny is that after I completed the tutorial I clicked back through the webpages and found it there. Weird.

Lesson 12 was all about setting up a more advanced XML layout. Not too much was new, which is nice. The main new thing we learned was setting a layout for our activity and setting a component’s weight. We took out new activity ( and it’s XML file: tutorial1.xml) and added an Edit Text field, a button, a Radio Button and three View Text fields. I guess the Radio Button was new too, but we didn’t really do anything with it except for dragging it into the design section from the palette. When we added them they were all a jumble, so we worked on tweaking the layout so it made sense.

A somewhat jumbled layout

Now that doesn’t look terrible, but it isn’t pretty either. And is not what Travis wanted it to look like. So we did some tweaking. I should note that he had us add a vertical orientation tag to our linear layout. Android Studio seemed to have already added this to mine. We reviewed gravity by centering a few things. Then we set a few of the components to fill the parent or wrap content depending on what effect we desired. This was review as well. Travis wanted the two text view directly following the edit text to appear on the same line as each other instead of occupying two lines as you see above. To do this we set up a new linear layout within our existing one, by simply copying the opening tag and pasting it between our edit text and the first text view components. Then we added a closing tag after the second one. Since we want this views to be side by side on the same horizontal line we changed our new orientation from vertical to horizontal. When we had a look at what this changes did we noticed we now only one text view and big empty space beneath it. We had to add weight to make it work.

Code from our Weighted Linear Layout

Weight was new to our lessons. If you look at our code above you can see that it was fairly simple to set up. All we did was tell the linear layout how much weight it had by using android:weightSum=”100″ as seen on line 19, and then we told each of the text views that they could use half of that weight. android:layout_weight=”50″ can be seen within both TextView’s on lines 27 and 36. This told both TextView’s that they could use 50 of the available 100 weight, or 50% or One Half. So they should each appear using half of the line. Travis also explained that we could get the exact same result if we set the weightSum to 2 and the layout_weight’s to 1. In my mind I took this further and decided if we want to split the line into 3 it might be best to use a number that is a multiple of 3. 100 does not divide into 3 parts using whole numbers… I wonder if weight can use decimals. If it can there really isn’t a problem. Or if the remaining weight is split and used a margin on either side it would work well. It also occurs to me that we could use weight in a vertically orientated layout to spread things out down the screen. Anyway, you can also see that we centered the gravity of both TextView’s. Let’s see how that looks.

Our Layout after Lesson Twelve

We continued to set up our new layout in Lesson 13. New things learned here included RadioGroup. RadioGroup makes Radio Buttons work as they are meant to. When you select any one button within a RadioGroup it will automatically deselect all others. Neat!

We started the lesson by adding 5 new RadioButtons by simply copying and pasting the existing ones. Next, we set up a new LinearLayout around all six RadioButtons with a weight of 2 because we wanted two columns. Then we used our new RadioGroup  and made one with a vertical orientation, fill_parent width, wrap_content height and a layout_weight of 1. We set this up around three of the buttons, and then did the same for the remaining three. This gave us 2 columns of 3 buttons each and within each column only one button can be selected at any one time. We finished the lesson by setting up the buttons and text fields with the proper words as well as changing the ids to be what we want them to be. Travis gave good suggestions for ids. He uses an abbreviation of the type of component and a quick label describing it. A TextView that says Style would have the id of tvStyle and a Radio Button that is labelled Bold would be rbBold. This seems to work well and I think I will adopt it. How do you handle ids? Any suggestions that work better for you?


A look at Our App after Lesson 13

It’s looking pretty good if I do say so myself. One thing I’ve noticed is that Travis’ app now fills the whole screen of his AVD, while mine doesn’t. I need to figure out how to make the radio buttons bigger. Any quick advice?

My First App

Welcome to a new segment of this blog. I’ll talk about an app I’m starting to work on here and discuss the progress I am making. So far I’m just deciding what to make. I know it is going to be a sound board, and I so wish I could base it off something popular like my beloved Star Wars, but I want to keep it legal and legit and whatnot. Then I thought that having it be a bunch of Monkey Sounds would be cool for the Wannabe Code Monkey, but it turns out free to use monkey sounds are hard to find. If I had a zoo nearby I would go try to record some, but I don’t. Currently I’m thinking I might just try to use a variety of  generic sounds. After all I’m sure the only people that will check out the app will be readers of this blog and family and friends.

Thanks for reading!