Code Monkey learns with Learnaroo

On again off again. I seem to go through phases where I really want to learn this stuff and then I always peter out on it. That’s OK. Somewhere in my mind I always have a desire to learn it, I just don’t always have the focus to turn that desire into time and action. A few days ago I got the focus again. I had heard about Codecademy in the past and that it was the best free way to learn how to code. They don’t teach Java. That was sad. I played around with the idea of just using it to learn a different language, but ultimatley decided that I needed to work specifically towards what I actually want to do, code Android apps. For reference, Codecademy currently has tracks for Web Fundamentals, jQuery, JavaScript, PHP, Python and Ruby. I also thought about going back to Treehouse. I really loved the style of that site, the fun videos and how quickly I was learning. The code challenges are great too. I just can’t afford the $25 dollars a month. Diapers and baby food are more important than me learning a new hobby. I highly recommend the site to anyone who can afford it though! Treehouse has tracks for Android Development, Web Design, Web Development, Rails Development, iOS Development, PHP Development, WordPress Development and even Starting a Business. You can use this link to get a free month’s subscription to try it out (it also gives me $5 off for every month you are subscribed!).

Okay, enough with the sites I am not currently learning! I found Learneroo. It seems alright so far. It doesn’t offer as many options as Codecademy or Treehouse do, but it does offer Java. The rest of what it offers are more nebulous. Here is the list of their modules: About Programming, Combinations & Permutations, Learn Programming with Java and Logic and Loops Practice. I started with the “About Programming” module which I found to be quite good. It didn’t really go over anything I didn’t already know, except an over view of the most popular languages and what you should learn based on what you want to do. They had a flow chart that pointed me to Java. Then I moved onto the Learn Programming with Java section. I’ve been working through it off and on for about a day. My attention is divided between it, my baby girl and a house full of company so it’s slow going, but I thought I would stop and revive this blog.

I’ve also started looking into ways to make a bit of cash on the side online. I’ve found a few site that pay you to do simple things. I figure if I can pay for my Netflix every month and get a bit in my paypal account it can’t hurt. Hopefully when I’m ready to publish my first app I’ll have enough to pay for the dev membership to the play store. I made a quick blog that talks about the sites. Feel free to check it out here.


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.

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:



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

Who Said Monkeys Can Spell?

Hey guys!

Lesson 6 from the mybringback Basic Android Tutorial Series was the one I’ve been waiting for. We are starting to learn Java and how it relates to Android development. I have no experience with Java programming so it’s all new to me. All the basic layout stuff is really interesting, but I remember it all from last year. I don’t remember any of the actual coding. I think I’ll just put up some code and attempt to explain what it means.

Code from main activity

Okay, so line one simply sets up the package with the name I gave it when I created it. Maybe someday I’ll set up a custom URL so I can use that. Lines three, four and five bring in libraries (?) from Android so they can be used in our app. I remember from before that you need to import different things based on parts of the OS or device you want to use such as Camera, internet, mic, ect. Line seven creates a new class which is Public, meaning it can be referenced by other classes, and it extends Activity (imported on line 4) which gives the MainActivity class all the characteristics that the Activity class has. At this point we could call MainActivity the sub-class and Activity the Super-class.

Line nine is where it gets confusing for me. Mybringback says “The “@Override” means we are overriding the method from the super class (Activity Class).” I’ll just leave it at that and continue on. In line 10 we call the onCreate method from the Activity super-class. The tutorial didn’t really specify but I think this method is used to make an activity (makes sense, doesn’t it?). This would pretty much make a page as far as I can tell. We also want to make some changes to the onCreate method and that is why we bundle it with TonyIsAwesome so that it isn’t exactly the same as onCreate because that would be boring! Line 11 is where we actually create the method. Note how we referenced the super-class. In line twelve we point to what layout file we want to display.

Lines 16-20 didn’t appear in mybringback’s code. But I think I know what it is anyway so I’ll hazard a guess. Line 17 calls onCreateOptionsMenu which I assume is why there is a menu button in the top right corner of my app. I guess this is either a built in feature of Android Studio or it is something that the SDK started including around Honeycomb or Ice Cream Sandwich. It’s a boolean, so that means it can either be true or false. Line 20 indicates it is true. I’m not sure exactly what happens in line 19, or at least I don’t know how or why it happens. I know it makes a menu button and calls up a settings option in my app. Clicking on settings doesn’t do anything. Yet. I’ll add to it when I learn how to.

This tutorial also had us add a new folder under src/main/res called raw. He had us put a sound in the raw folder. I searched my PC for wave files and found one called JKIIstart.wav. I didn’t listen to it. I assume it’s a sound file from Jedi Knight II. It’s also short and I thought that would probably be good. This .wav file seemed to have caused some issues. AS wouldn’t associate it with a file type. I chose to just remove it until I found out what we were doing with it. I also tweaked the background I had made earlier to be less transparent and set it up in the splash layout.

I’d love to hear from in the comments. Am I missing anything? Can you fill in the parts I’m unsure one?

The Next Lesson talked about Android Activity Life Cycles. We didn’t do a whole lot in here other than some set up to get a working splash screen. I’m going to put up an Android Life Cycle chart for reference, but other than that I won’t say too much about this lesson, as when it finished we didn’t have anything new working. In fact we might have broke a few things.

Activity Lifecycle chart

Lesson Eight! Android Splash Screen with a Thread. This lesson caused me all kinds of problems, but not for any good reason. We learned how to set up a Java thread with a timer and edit the AndroidManifest file a bit. I learned that a thread requires a Try, Catch, and Finally section. In the Android Manifest we told it that we had another activity and specified which should launch first. We told it to start with our Splash Screen by labeling it with a LAUNCHER category. I believe we will set all other activities to DEFAULT so they will only be started when another activity calls on them. This what we did with our new Menu Activity.

After 5 seconds on the Splash Screen the app now automatically forwards onto the menu.

The timer thread I talked about earlier was set to 5000 milliseconds so that it will stay there for 5 seconds, then run an intent to call the menu activity and finish the splash screen one. When all was said and done I tried to run my app in the emulator. It got errors. I spent 2 hours tweaking and pouring over my code trying to find them. It turns out if you spell “Activity” like “Activiy” it doesn’t know what to do. I was both mad and relieved when I found the error. It just goes to show how little mistakes can really throw you off in programming.

Travis (the mybringback tutorial guy) mentioned that Splash Screens can be a good branding tool within your apps. I’d like to say that I’m not sure I agree with him. In our example it just added 5 seconds of time that the user can’t interact with our app. To me that would just frustrate them if there is something they want to do. Maybe I’m missing something. To the real developers out there… What do you think? Do you use them?