Wednesday, July 3, 2013

Layman's Guide to Android Programming - 1 - Setting up your project

Hi all,

Today I'll start with, setting up your first project. I can hear a "What??? We're setting the project and not learning programming?" somewhere. Chill people, there are some minor details we have to pore over first.

-Creating a new Android Application Project

In Eclipse, click on "File" (top left), "New" then "Android Application Project".

You should then arrive at the next image. Let's take a look at the various fields.



-Specifying the application details

For details, mouse over the fields.

"Application Name" is the name of your application, which according to the help text at the bottom, "... is shown in the Play Store, as well as in the Manage Application list in Settings.".
I would like to add that that is the name of your app in the menu as well.
No fear, if you typed it wrong here you can change it later, in res/values/string.xml under the string app_name.

"Project Name", used within Eclipse as an identifier. No big deal screwing up here, but name stuff properly for the sake of it and also if you have many applications to manage. I wouldn't want to name it MyApp1 to MyApp10 and have no freaking idea what's what.

"Package Name". This is the unique name that must be set for your app. Note that this must stay the same for your app. If you ever have two applications that is almost the same, e.g. A free version and a paid version the package must be different.
It's usually in the format com.organization_name.product_name.
So in my case it would be com.turtleSpeedCoder.superAlarm or something like that.

"Minimum Required SDK". This determines what users can access your app on the Play Store. Somewhat to the tune of "Minimum height to play this ride". Changeable easily later.

"Target SDK". This is the version supported up to. If your app is designed and tested til a certain version, this is what you'll select. Changeable easily later.

"Compile With". This will be compiling with the SDK version. In layman's terms, this would be equivalent to validating your code with a particular set of rules. You can keep it the same as Target SDK.

"Theme". Presets your app with a theme. Note that themes are included as part of the SDK, so some themes will not be available with the older SDK versions.

Let's go "Next"



-Configure Project

For now, let's uncheck "Create custom launcher icon". It's a hassle for me to explain it since it's more of a design issue rather than a programming one.

"Next"



-Create Activity

What is an activity? It is something that you show to the user. Think of it as a piece of paper that you hand out to your users. Be it a log in screen, a welcome screen or a menu, these are represented by an activity.

It is possible to code many interfaces and pages into just one activity, however that is bad practice and tedious.

Let's start with a blank one. (FYI, I haven't meddled with the other two. As of today, I'll be learning the Fragment UI, which is associated with the "Master/Detail Flow".

"Next"



-Blank Activity

"Activity Name", This is the class name that your main java file will be named. You can name it to your liking, hopefully with the proper naming conventions, like LoginActivity or MenuActivity.

"Layout Name", Similarly, this is is the Android XML file. Likewise as above. Note however, that for Android XML files, they are all lower cased. You can separate words by dashes "-" or underscores "_". The guys at Google typically use underscores.

"Navigation Type", This is some presets that you can set to your activity. However, since we're here with the intention to learn, let's start with a blank slate. Select "None" and "Finish".



And with that, you have gotten through your first step in Android Programming! Stay tuned for the next lesson (or my on and on droning).

Monday, June 24, 2013

's been a long time! (Yes I left out the It) - Foreword to Layman's Guide to Android Programming

Hey my dear non-existent (and perhaps the lost user that reached here by accident) readers,

I'll be starting a new section of "Guide to Android Programming" page. This shall serve as the foreword (which will be linked to as Foreword when I create the guide).

Why the intention to create a guide? First off, I needed to transfer my knowledge to my interns. Rather than being a one-off effort, I might as well create a guide that they can refer to and look back upon which can also be reused by future potential colleagues/interns/subordinates/minions (BWAHAHAH!!!).

I've thought of creating my own guide for a long time but lacked the reason and motivation to do so. Since most books and guides are cryptic and riddled with terminologies that befuddle the newborn Android infant, often filling useless (useless at the point in time) information in tutorials that trip and waylay the poor programmers, I've decided to throw in a simple and easy guide.

For example, assuming I've creating a guide to Java Programming, here's what you'll see in most tutorials. The most basic would always be the "Hello World" example so let's not talk about that.

"Here's a tutorial to Web Form, now let's throw in various unnecessary and hard to understand (many) lines of programming code to get my point across."

If you're asking me, what is a Java class? I'll give it to you in less than 20 characters. Yes, 20 characters, not words.

public class a {}
That's a working class, but does it do anything? No? Of course. A program does what YOU want. So I'll be teaching how to construct a basic class (depending if you're wanting program or applet) and then the little itty bitty basic stuff which will help you do the stuff YOU want. No crazy words and stuff that you'll need a dictionary by your side.

So with this, enjoy your journey!