The Code Monkey Slowly Remembers

Hey guys, Wannabe Code Monkey here!

I had family visiting over the Long weekend (Victoria day here in Canada) so I didn’t get too much done on the coding front. I did get Android Studio installed and working without too much trouble. A bit of problems after I loaded it when I tried to open it nothing at all happened. Turns out I hadn’t installed Java JDK on my new Windows 8 build yet. Then it still wouldn’t work until I had set up a home variable for it. I figured this out by finding a post on stack overflow.com.

I also watched a few YouTube tutorials (mybringback and thenewboston) in my downtime before the family all woke up. These were mostly redundant when using AS (Android Studio) as things are already built in, but I chose to watch them anyway as a refresher. I got as far as setting up a new project. Things started coming back to me. While looking at activity_main.xml in res/layout I saw the TextView and went to change what it said. AS was kind enough to tell me that what I highlighted (and was about to delete) was just pointing to a string elsewhere. I remembered I could find the strings in res/values/strings.xml. I also remembered thinking Strings were really cool so you could change things in multiple places at once just by altering the string file. If I recall correctly this can also really help with translation to other languages. After finding the strings file I changed the defualt hello string to something different and then added a second line of text simply by copying the TextView in activity_main.xml. This caused an issue since the original TextView had an android:id that I copied over. AS didn’t like having two of those the same as far as I could tell. I simply deleted the line from the second TextView and that worked. Next I changed the text from the hello string to just some text, with no string attached. Again that worked, although AS protested and told me I should really use a string. That’s nice of it. Also nice is that it opened a dialog box to quickly turn my text into a string. Fun! Oh dear, I find THAT fun. I think I need to play some video games to realign my head! Once that was taken care of I had a look at the design tab for activity_main.xml and noticed a new problem. The two strings of text were showing up over top of each other on the first line of the tab. Since I couldn’t figure out how to fix this when staring blankly at the text tab, I headed back to the Design tab and simply dragged and dropped the second text string down to the next line. When I went back to the Text tab it had added

android:layout_alignLeft=”@+id/textView”

to the second TextView’s field. @+id\textView is the id of the first TextView. Interesting.

Android Studio multiple layout view showing my test app

The next reasonable course of action I could think of was to get this running in an emulator. I created an AVD. I opted for the pre built definition of a Nexus 7. It wouldn’t run. I thought about searching around online to find out why, but decided to poke around first. When I went to edit I noticed a message at the bottom stating “On Windows, emulating RAM greater than 768M may fail depending… Try progressively smaller values of RAM is the emulator fails to launch…” Part of the message was cut off, but I got the main point and reduced the RAM to 700 and it started no problem. Now I’m mostly just messing around before diving into the next videos.

In other slightly related news: I had held off picking up a Nexus 7 since all the rumors pointed to a new version being released at I\O. Since it didn’t come I picked one up. This will replace my Acer Iconia A500 that isn’t working at the moment. I still hope to get it running again, but I wanted something smaller anyway. There are a few features I will miss from the A500, but so far I love the Nexus 7!

My new Nexus 7

I think I’ll go play around in AS a bit more before calling it a night. As always comments and advice are welcome!

Return of the Code Monkey

Or should that title read “Revenge of the Code Monkey”?

So, you may or may not have noticed I have not blogged in a very long time. The last time I graced this blog with my presence was back in November, 2012 which would be, oh… about 6 months ago. Yep, half a year!!

If you were paying attention, you know that I was taking an online course through coursera.org. I was attempting to learn how to code in Python. I bet you have a few questions. And if not, that’s ok. I’ll answer them anyway!

1. Why did the Monkey stop blogging about the course?

This is pretty simple. The course was really challenging for me. It took most of my free time just to watch the lectures and complete the assignments. With working full time and doing the course, plus spending a little bit of time with my wife, I didn’t have the energy to write much.

2. What did the Monkey think of the course?

As I mentioned, it was hard for me. I’m not really that great at math and I quickly found out that the course was going to require a lot of it. I ended up doing some extra homework to bring my math skills up to par. You see this particular Monkey seldom payed attention in Math Class. Plus High School is a few years ago now… “I’ll never need this in real life!” “This is dumb.” “Why are there letters in this math?” are all phrases you might have heard uttered by me in high school. Sorry Mr. Bodnarick. Funny aside, earlier this week I asked my 14 year old niece what she learned in school that day. “Nothing.” she replied just like every time I ask her that. I pressed on and she told me she had learned something about triangles inside of circles and that she would never ever use that in life. I felt very old as I explained to her that I used to think that about everything taught in Math, but now I wish I had payed more attention. What she was learning this week might have helped me build pong in Python! Woah! off topic. Once I made it past each math hurdle thrown at me, I enjoyed the course. It was challenging but I learned a lot about coding and about how to think about programming. While taking it and ever since I find myself thinking in If/Else/Then statements a lot. Hopefully this type of thinking will help me as I continue.

3. What have you been doing since the course ended?

Not coding. I actually did not complete the course. I didn’t plan it out too well and for the last 2 weeks of the course I was in Disney World. I had the course loaded up on a laptop with the intentions of doing it there and I did work on it a bit in the first few days, but in the end the sunshine and the “Magic of Disney” won out and I chose to just enjoy myself and see and do as much as I could while there.

2012-12-04 10.22.36

And when I got home? I had lost momentum and didn’t pick back up where I started. Instead I ended up playing video games. (Star Wars: The Old Republic in case you were wondering) I stopped coding all together. I couldn’t convince myself to finish the Python course alone using an online IDE (codeskulptor.org) that I would never use again with a programming language I didn’t really plan to use in the future. I didn’t get back into Android coding either. I did nothing,  and then life got a bit crazy. My wife and I moved 669 KMs (416 miles) from where we had been living. We had a beautiful baby girl. I left my job as a Computer Technician and started life in a factory making corn chips. In short a lot of big changes in a short time.

4. Why is the Monkey returning now?

AndroidStudio

Google I\O 2013 unveiled the Android Studio IDE. Seeing this announcement reminded me that I still have apps I would like to make and a desire to know how to make apps in general. Shortly after I was downloading the new IDE and looking for tutorials again. I’ve decided to stick to strictly Android developing. It’s what I want to do and I feel the Python course was a great intro to programming in general, but I’m want to focus on things I can apply directly to my app idea’s. I have Evernote notebooks filling up with thoughts and plans, but I don’t know how to implement them yet!

My first step back into the coding world will be to go over some video tutorials from bringmyback. I watched the first one which was on Eclipse/ADT/SDK install. All made very simple with Android Studio! I bet soon I’ll be making another “Hello, World!” app.

If you have any tips or suggestions I would love to hear them in the comments.

Code Monkey says goodnight.

MONKEY SCRATCHES HEAD A LOT

Alright, so you might have noticed I’ve been gone for a while. I stopped coding for a while, or trying to code as the case may be. Why not? Well, I just wasn’t learning much with the methods I was using. Essentially all I was doing was copying what I saw in various tutorials or books into Eclipse and calling it a day. But I didn’t really learn what I was doing. I was also very hung up on only trying to learn java and/or android development. Android development is still my end goal, but I have taken a step back. Over the last 4 weeks I have been learning to code in a new way, and I’m ready to start writing about it and sharing it with you.

Image

This post is just an intro to what I have been doing. I found Coursera. Basically, this site lets you connect to many high level institutions and professors. Unfortunately the Android Development course I signed up for hasn’t started yet or even given a start date. So… I am taking a Python course. I feel it will still benefit me when I move onto Android Development because I’m learning how to think logically like a programmer needs to. If, Else, For, While and so on all apply. As do the design process and thinking. And I can actually learn in this format. Coursera is structured with video lectures from the professors, quizzes and mini projects. The mini projects are great as you get a basic template and specifications as how the program must work, but then you must put in the code. It’s not just copy and past. It’s using the information from the lectures and examples and applying it to the given project. These projects are then peer graded, so you get to learn more as you look at other student’s code and implementation.

I will follow up this post with a few more in depth posts about the various projects. This week we are making a pong game.

 

Designing a GUI

<BlogPost>
<CheesyAnnouncerVoice>
      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.
</ CheesyAnnouncerVoice>
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 GUI for a tutorial app with Title Text and Four Buttons

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 Button triggers a Pop Up with Text describing the App

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.
A settings page with 2 check box options

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.
</ BlogPost>

In Search of a New Source of Knowledge

UI Fragments on a tablet vs a Phone screen

The most exciting part of my recent lessons

This will be a pretty quick update. I’ve been following through the Lesson’s on Google’s Android Dev site and while the first lesson on Building Your First Application was great and really helped, I am starting to become disappointed in the lessons. I’ve done a few more lessons covering subjects like Activity Lifecycle, Supporting Different Devices (and Lauguages) and Building a UI with Fragments. It seems like beyond that first lesson where we built an app the lessons have become more theory and less practical. This shift has made it harder for me to follow along and get anything out of the lessons. Without actually having something to code it has become harder for me to get a feel for what is truly being taught. I understood the part on Languages just fine and think that the different values folders is a great way to handle it. Easy to package and add new languages after the fact. Different device sizes is handles in a similar way, but since it dealt with different layout files and didn’t walk through how to create them the lesson was lost on me a little bit. I am hoping that I’m still getting a bit of understanding from them, and that later on I will find myself using this information. It is neat that they come with sample applications you can download, but I would much rather they walk us through CREATING those apps so we can see how it works. At this point I think it will soon be time to find a new learning resource. I’ve been reading through a book called Hello Android and I think it might be my next main focus. The introduction mentioned creating a Suduko App and then as you learn new things you keep adding to the app. That sounds interesting and like a better way for me personally to learn. I have no doubt that in the future I will be returning to the Google dev site to look things up and learn about specific things as they come up, but for now, I need something holding my hand as I go and that keeps me coding. I guess I’m a learn by doing type of person, not a learn by reading.

On a different note I have used dropbox to import the application I made and mentioned in my last post to both my Tablet and Phone in AIDE. I was able to successfully compile the project and run it on both devices so that is good news. It means I should be able to create apps in Eclipse on my PC and then work on them while I’m on the go. I think this will be important when I get to the stage to be able to work on my own projects as I can utilise breaks at work and whatnot to do it.
One last thing: I’m really happy to see my blog getting as many hits as it has been. Thanks to all who have been visiting and commenting. especially to those that have answered a few of my questions. Please keep coming around and if there is anything specific you want me to write more about just let me know.

Finally

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…
My current set up where I develop. The PC powering the monitors is an Acer with an i7, 8gb RAM and decent GFX Card. And 80gb HDD...

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.
I wonder if this will work... ?

First Activity of my first App

It worked!!

Second Activity

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. :-)

Eclipse, SDK, ADT, API and a Head Ache for this Monkey

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.
Where I'm at right now

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!

Syncing…

When we last left off I had 3 “apps” I was trying to create. I still have 3 apps I am trying to create. I haven’t really had much progress on any of them. I have spoken with the makers of AIDE through their Google + page and found out that Acer android devices seem to have a bug, or at least difference in their firmware that caused issues building apps from code made in AIDE. This seems to lead to the issues I have been seeing. Someone mentioned they were able to take that code and compile it in an app called Terminal IDE so I downloaded that have played around with it a little bit. To be honest terminals scare me a little bit. I much prefer working from a nice IDE like AIDE or Eclipse/Netbeans. To that end, I still have not full configured either for actual Android development which is my main goal in all this. In fact, I have sort of decided to back away from learning Java on it’s own, and focus more on actual Android development. I know the very basics of Java now and feel that focusing on Android will be more advantageous to me. I’ll configure Eclipse and/or NetBeans for android development within the next week, but I’d really like to continue to code using my Tablet. With the bug in AIDE and Acer firmware I cannot compile my code directly on my tablet. AIDE includes a sync option to both dropbox and GIT. I don’t know what GIT is, but I’m a heavy user of DropBox. I’m thinking I should be able to code on my tablet with it’s larger screen and wireless keyboard and then sync to dropbox, sync again on my Galaxy Note phone and compile there. I have yet to try it, but if this works I should be set. The first app I want to make is actually a tablet app so compiling it right there would be really helpful in testing the layout. Oh well, we can’t have it all!
… Hours later…
I deleted everything from my Development dropbox folder. I didn’t want the half finished projects weighing me down and thought it was time to start with a clean slate. I pulled up a tutorial direct from Google’s Android Developers site and set to work on my tablet (Am I a sucker for punishment?). It all started off fairly well and I even was able to change the layout and run right on my tablet. I made a user input field and a button. Then it started to get a bit more complicated, but I calmly followed the directions and copied down the code I needed to. All was looking good and then: The red X and squiggly underline started popping up all over the place. By the time I was done following the tutorial I should have had an app that had a text input and button where when you input text and hit the button, the text you put in appears on  a new screen in a bigger font. Instead I ended up with 24 errors. And these errors do not make sense as the syntax is exactly as it shows on the tutorial. I think my issue MIGHT be in libraries. I don’t understand them and in the tutorial it mentioned (very breifly) that Eclipse would have all the libraries needed. But… I’m not using Eclipse… And I don’t WANT to use eclipse. I also tried to sync with my phone to compile, but it shows the same 24 errors so there goes that idea. Next step: Configure Android SDK in Eclipse and try again.

Uploaded from the Photobucket Android App

And then it was supposed to make a new page (activity) with that text on it.

As a side note, I found a blog where an Android developer used to post his monthly income from developing… Wow, it has gotten me excited to get going with this journey. I’m not sure why because I haven’t really felt a need to sell the apps I plan on making. I was thinking a donation link would be all I would include, and no ads. But if I can make the first few successful apps I might look at ideas for apps I could monetize. That thought is obviously getting WAY ahead of myself. Let’s step back and continue the journey of learning to code first.

Hello world!

“Hello world!” was the default title for this post. It was created by wordpress and meant to be changed. The only problem is, it’s pretty much the perfect title so I’m leaving it there. This post is going to be short. Just a quick introduction telling you about this blog. It’s going to document my quest to become a Android Developer. I’m going from close to zero coding experience to (hopefully) being able to code and publish my very own app. I’ve got an idea in my head and I’m working to make it a reality.  I hope you join me on this journey. If you’re thinking about learning to code this might act as a great way to learn. At the very least you can learn from my mistakes. I won’t be writing tutorials, but I’ll be talking about what I do and what works or doesn’t work. Perhaps you know me and want to see how this personal project is coming along. Feel free to subscribe, share and comment. Hopefully this will be at least some what enjoyable.

Road Blocks

 

 

July 21, 2012

 

 

 

I started trying to learn how to code Java application 20 days ago when I had an idea for an Android App I would like have and use. Since no one else has made it I thought that I should learn how to and make it myself. I like to think I’m pretty smart guy. After all I’m employed as a PC Technician… How tough could this be?

Image

Turns out, it’s pretty tough. I hated math in school and it turns out it’s used a lot in Java Programming. I started out by trying to jump right into Android Development. Now, what is a Computer Technician to do if he wants to learn a new school? Yup, you guess it! http://www.google.com. The first few android developement tutorials I came across assumed I had a fully working understanding of Java Development. I did not… Back to google I went. This time searching for java development. I quickly learned that youtube video’s were going to be the best way to learn. I found what I thought was a good java tutorial video series and followed Oliver’s directions to install NetBeans. Pretty soon I had coaxed my code to print out the simple phrase “Hello World!” Since would be the first time of many that I would code those words. Hmmm, well that’s pretty simple. By the 13th lesson I was getting input from the user. Now, I start to see something that I will need in am own app. I know I am still a very long way from being able to make it. Soon I was getting data from a file saved on my computer and writing data to a different file. Things were looking up and I was feeling pretty good about my chances of being able to make a working app one day. I found myself becoming consumed with learning all I could about java. Reading tutorials at work, watching youtube video’s on my coffee breaks and looking forward to getting home to netbeans to try it out. I didn’t understand everything I was reading, or even everything I was watching, but when I was able to try it out in netbeans while following the program I could get it to work. Almost always…
 
One morning before work I got up and set to work on the 17th video in the series. I had watched the video a few times the day before and although it was more complex than anything I had before I thought I had a handle of how it worked. It was a basic calculator program that could perform basic mathematical operations that the user input. The only issue is it didn’t work for me. Something was wrong, and before I could work it out I had to leave for work. It would bug me all day, but I had to move on. My main work PC was down, limiting what I could do during the work day. With no manager in to approve a new PC I found other ways to keep my self amused. I installed {AIDE} on my Galaxy Note and found a tutorial to start coding for Android. This seemed like a win, so I wasted away the wait times in my day as diagnostics ran on the few PC’s in my shop. The guide was for using eclipse, but I figured it was be similar to use {AIDE} since you can import projects from eclipse anyway. I started a new project and went to work on making my PC output the word’s, “Hello World!” Hmmm, where have I seen that before? The guide went on to show how to change the colour of those words. I changed to them green, and recompiled the .apk. After discovering the the guide had some syntax errors I got the text to change colours. Next the guide went on to add a new layout element: A text input field. This would be needed in my eventual app, so I was excited to learn about. Sadly, this is were the guide started to lose me. I found that it didn’t explain what the code it was adding meant, but I tried to copy it into {AIDE} just as it appeared in the guide. After I had copied it all in I was presented with 37 errors! Including some in the blocks of code that had worked just fine a moment ago. Suddenly it was telling me their should not be a ‘/’ in ‘string/hello’ but that would mean it would not pull the string up from the res folder. That’s not what I need. I re-read the guide, started over and tried again and again always to get hung up at that spot. My work day came to an end. Once home, I synced the broken app from my phone into my 10.1″ Acer iconia A500 and attached my keyboard. I pulled up the guide and started trying again. This time with more concentration and less distractions. Still no luck. I deleted the project and started again, hoping that I would some how avoid the issue this time. This time as I went I made other changes to test things out. I added to the main “Hello World!” string so that it displayed: “Hello World! Testing 1, 2, 3″ and compiled and ran the app. It worked! That got me a bit excited. I had found out how to do something on my own. Encouraged by this small victory, I went back and added more onto the string. I added: “It worked! That means I can add this and it’ll appear in the app as well.” Compile, install, run. “Hello World! Testing 1, 2, 3. Wait a minute! Why didn’t it work? Went back and checked the code… maybe I didn’t save it before compiling. No, it’s there. Well this makes no sense. 
 
So here I am with 3 different beginner Java Programming issues. Who knew copying down code someone else wrote for people just getting started in programming could be so hard. Now this wannabe code monkey is left wondering if he really wants to be a code monkey or if he should just stick to simple repairs. It’s an interesting dilemma since he’s only coding for a side project and really doesn’t aspire to make any money off it. I don’t think we’ve seen the end of this wannabe’s journey into codeland.