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

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


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!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s