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:
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.
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.
I’ve started using teamtreehouse.com 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.
Some of the things you can learn
Hello and welcome to the next ‘chapter’ in my Quest to become a code monkey. When we last left our hero he was slightly disenfranchised with his grand journey. He was not learning much and needed to find something new.
I mentioned Hello, Android
and that is what I have been focusing on. I think I’m falling into a nice rhythym with it. I’m not going quickly but what I do is read through a section (usually on coffee breaks at work) and then later go back and follow along while doing the actual coding. I think it’s working pretty good and is even making more sense. There are still parts where I stratch my head and wonder why that code was written and exactly what it means. But I think with more practice and use it will start to become more clear.
The Launch Page of the App Hello, Android is teaching me to build
So far I’ve been learning about UI set up. With that I have set up a launch page UI including title text and four buttons as seen above. I feel pretty solid about that code and how it works. When we start linking the buttons to actions I get a little bit lost. onClickListener is what checks to see if the button is hit or not, but I need to go back and at the surrounding code to get a better handle on it. We also learnt about setting up the UI for different screen orientations so that everything looks nice regardless of whether the user is in landscape or portrait mode. This allowed us to set up our first table view so we get the nice columns in landscape mode. I also set up an About page which is triggered by hitting a button. This page is styled with a Theme so that it appears as a pop up with the original activity visible behind it. That was pretty cool.
The About Page themed as a Pop Up box
Finally we started setting up the settings options. I’m pretty sure this is just magic. I didn’t really set much up and yet, there’s the page. I guess we haven’t set up the results for it yet. We don’t have music to turn on and off and we don’t have hints yet, so maybe when those features get implemented we’ll see how they link up.
The Settings Page
It’s been fun doing this coding and seeing the results on the emulator. I wish I had made coding more of a priority this week. It would have been great to have the basic game play coded so that while my mother is visiting this weekend she could check it out since she used to play a lot of sudoku. Oh well. Can’t win them all.
I love it when a plan comes together. The last issue I ran into (there being no options for SDK when creating a new Android project in eclipse) was caused by an empty Android SDK. I thought I had downloaded a few API’s but I guess I had not. That must have been on one of the numerous previous installations of the Android SDK. By the way, SDK = Software Development Kit. So, with that little issue out of the way late last night, I was able to wake up this morning and succefully create a sample Android Project. I was in a pretty good mood as I headed out to work for the day. I couldn’t wait to get home and start working through tutorials.
First thing at work I’m told I have to become Apple Online Sales Gold Certified by 2 pm. I’m not exactly what you would call an Apple Fan so this didn’t put me in a great mood… From 9:30 am to 1:55 pm I did nothing but read Apple training and answer questions. Then after mentioning to my manager that I got the Gold level just before the deadline he tells me I have to hit the next level (Apple Product Professional) before I head out for the weekend… Great. I hit that level as well and I guess I get a pin for it. Yay… OK, so that last part wasn’t important to the story of becoming an Android Application Developer…
Ah, Android and Windows. 🙂
It felt really good to get home and create an Android Emulation Device and run my sample program in it. After I got that out of the way I went through the first lesson on Google’s Android Developer page. In it I learned how to create a basic User Interface including an Edit text field and a button, start a new activity (which makes a new screen), and get to the new screen from the first one while taking information from the first one with you to the second one. It really wasn’t that hard, and this is actually my second time going through this lesson. The first time was on my tablet using AIDE and it resulted in 34 errors. I’m happy to announce that this time, using Eclipse IDE, I came up with zero errors and an App that works as it is supposed to. After going through the lesson 2 times I still could not reproduce it on my own. Or in other words if you came up to me and said, “Hey, I want you to build an Android App where a user enters text on one screen and then the app displays that text on a new screen.” I wouldn’t know how to do it. Even though I have already built that app I couldn’t do it at this point with out the step by step instruction. At the moment I will assume that in time I will be start to truly put together what I am doing and part of it will become memory. I understand what almost all the code I used means so that isn’t the problem. It’s just knowing what to use when and where without the instruction. Again, I assume that will come with practice. Patience my young apprentice.
I’d like to take a moment to mention that the troubles I had setting up Eclipse for Android Development are apparently not the norm. I’ve got a friend that’s into development, but hadn’t done much if any Android work until I mentioned I was going to work on it. After hearing about my woes with environment set up he said he had no problem installing the SDK and ADT Plugin for Eclipse. I wanted to mention that so it didn’t discourage any one out there from looking into Android Development.
First Activity of my first App
My next steps are to continue the lessons on Google’s Android Development site and see if a completed program’s source files can run in AIDE on my tab. 🙂
The Chronicles of a Wannabe Code Monkey continue and hopefully will start to get more interesting soon! I spent the last two nights (when I wasn’t cooking/eating/working out/doing other stuff) removing all the things needed to develop android applications from my PC. That means I removed the Android SDK, Android ADT and Eclipse IDE. When I first installed them I had been a little too excited about this whole thing and hadn’t paid close enough attention (apparently) and could not get them working. I could get everything working on their own. Eclipse worked and I could code basic Java apps in it. The Android SDK was installed and I could set up an emulator environment and so on, but I just couldn’t get the ADT plugin to work with Eclipse. The first error code I got made me think I needed a different version of Eclipse, so after hours of scouring the web I found one I thought would work. Well, ok it took my 94.3 seconds to find it with my ninja google skills. After installing this version of Eclipse I got a whole host of new error messages. Deciding that something wasn’t right and in my haste to get everything going I missed a step or added a step something I decided that the best course of action would be to just start over.
Maybe installing these (again) will help…
I still think the issue may have come from compatibility issues between Eclipse and the current Android SDK/ADT Plugin. With that in mind I found a site that had a bundle zip file available for download that included everything I need. The package can be found here
. After finally getting the download finished (it only took approximately forever) I went about installing the various components. Finally I was ready to open up Eclipse and get to work. File > New > Android Project (WOW! It worked!!) Start filling out the required fields… More problems. There is not options available in the SDK field. In it won’t accept any application names I choose. No matter what I do it just will not work for me. I’m starting to get frustrated with this, but I’m not going to let it stop me. I’m determined to become an Android Developer.
Have you ever tried something numerous ways and ran into problems at every turn? What helped you get past your hurdles? Share in the comments!