jay's old blog

this blog will be deleted soon - please visit my new blog - https://thesanguinetechtrainer.com

android training – Episode 2 - Before you start developing

Hello and welcome back. May name is Jay, and I am your trainer for today.

We are going to assume that you already went through Episode 1. If so, here, we want to talk about a few things that are not just about android development, but development in general.

Your Computer

Your computer is by far the most important friend in your journey to become a developer. It is like your boyfriend/girlfriend. That means, you should take good care of it otherwise your boyfriend/girlfriend will leave you hanging when you need him/her the most.

What does taking care mean?

  • Ensure that your computer has an always on internet connection. As you will learn as this training progresses, developing without internet connection is impossible. Ensure that you have a decent internet connection.
  • Viruses! For the sake of god, please do not just plug in any and every pen drive into your computer. Keep your antivirus updated.
  • Free disk space – Ensure that your computer has at least 50 GB of free space in the C: drive. Do not fill it up like crazy.
  • Wireless Keyboard/Mouse – Please make sure that your computer and especially if you have a laptop, you use wireless keyboard and mouse. Today, you can buy a wireless keyboard and mouse for less than a 1000 bucks. Please become wireless. Also, don’t type on the laptop keyboard. It will hurt your hands, and make you less efficient.
  • UPS – If you are using a desktop, get a basic UPS that will at least give you enough time to shut down the PC when you are working.

Knowledge of Java

Android is a platform, an operating systems. On top of it runs apps. Our training reference app ‘alert nildana’ is one such app and it runs on top of android. The programming language used to develop apps for Android is Java.

The big question is, do you need to know Java? What if you are coming from a C background or C++ or C#? What if you have never coded before?

There is no definitive answer, but rather an explanation. If you know Java, then you will really have a easy time understanding this training program. Like, really easy. If you know any other language, especially C++ and C# (Object Oriented Programming Languages), then you can figure out most of the code with some difficulty.

If you don’t know any programming language, it will be tricky but not impossible. Well, nothing is impossible.

Android Studio

While this tutorial was being written, the officially supported IDE for android development is Android Studio. For those who are new, IDE (Integrated Development Environment) is a software used for developing applications. Each platform has its own IDE. For instance, if you are building apps for web and desktop, you can do using Visual Studio IDE. Coming back to Android Studio, yes, Android Studio is the IDE you will be using.

Google Developer Account

If you are serious about android app development, you should get yourself an account for the Google Play Store. Do that right away.

Credit Card

Yes, it seems silly to mention credit card here but you will eventually need to make some purchases and credit card is the only way to do it. So, borrow one from your parents or brother or sister. Keep it handy

Well, those are all some ‘things’ I wanted to share before we just head first into coding. If you are ready, move on to Episode 3, “Setting up your computer”.

Follow me on twitter, facebook and instagram for more updates. Thanks!

android training – Episode 4 - Hello World – Part I

Hello and welcome back. May name is Jay, and I am your trainer for today. We are going to assume that you already went through Episode 1 to 3. Now, it’s time to build that hello world project.

We are jumping into development now. That means, the page will be heavy with screenshots. I have tried my best to use low sized images so that you can load this even on a 2G connection. If you are having issues loading any of our tutorial pages, contact us. You will find the contact information, at the end of the blog.

You can download the code for this project, from GitHub, right here – https://github.com/Jay-study-nildana/helloworld2

If you don’t know about GitHub, check out our blog post here - http://blog.studynildana.com/post/study-nildana-and-github

Here is what you will see when you run Android Studio for the very first. Select the option that is selected in the blue circle. This will create a new project for you.

The next image you will see will be something like this

So, there are three parts here

  1. Application Name – This is where you get to choose your project name. You can give any project name you want. The example names are – ‘HelloWorld’ or ‘helloworld’. If you try to start your project name with a lower case or small letter such as ‘a’ or ‘b’, Android Studio will give a warning. You can safely ignore that, and your project won’t be affected in anyway.
  2. Company Domain – This part always confuses people. The thing, you don’t need to have a website or any ‘domains’ to write here. You can write any company domain you want. For example, if your favorite hero is Shahrukh Khan, you can write the domain as com.srk.apps or srk.apps or apps.srk.com. Just remember that the domain name you use, will eventually show up when you publish in the app store. So, ensure that you choose a domain name that looks cool and simple. In our photo, we are selecting ‘com.studynildana.apps’ and as a general practice, we use the exact same domain for all our apps.
  3. Project location – This is where your project will be store. You see that folder called “AndroidStudioProjects”? That is where you can copy paste our project folder and run it. Same works for any project that you get from the internet. Just put the project folder into this ‘AndroidStudioProjects’ and then open it from Android Studio.

Here is the same photo, but with the ‘Hello World’ project and study nildana domain and project location. Note that red error at the bottom. That is coming because I am using lower case letters for the app name. I am going to ignore that error. If you are bothered by that error, please use ‘Hello World’ as the project name instead of ‘hello world’ as I have done.

Now, click next and you will see something like this.

The circled part is the ‘Minimum SDK’ and I have chosen API16 that is connected to the 4.1 version of the Android OS. Someday, I might write up a post why you should choose what version. For now, understand this. Choose Android 4.1 (API 16), so that most of your friends can install and run the app you are about to build. The other options – Wear, TV, Android Auto – should be left alone. We are not focusing on building the app to run on watchers or television or cars. Someday, when you start building apps for these devices, you will check those boxes.

Next, you will see this window where you select an activity.

Write now, we are building a simple activity. In a future post, you will learn more about Activities. For now, go with the blank activity.

And then, you will see this image. Leave everything as it is, and click Finish.

The project will be created and you will see something like this and you are ready to go.

…and this is where your first project

Oookay, this one is big. Let me go through all the 8 points.

  1. Menu – This is the menu. Here you will be using the following a lot – File (for opening and creating projects), Build (for building the app and also generating the APKs) and Run (configuring the emulator and other stuff). Most of the time, you will be using File and Build.
  2. Project Structure – This is your app structure. This is where all the files of your app are shown in a tree form. You can change the view of this structure by using the option on the top left corner of that circle. The selected view in the photo above is ‘android’.
  3. Widgets – These are standard readymade widgets (things like button, text input and output) that are available for you to drag and drop into the Layout (pictured as number 4 in the image)
  4. Design Preview – This is where you get to design your app. Drag and drop things and select widgets. As seen in the picture, you might get a “Rendering” related error. Don’t worry about it. This happens with Android Studio, quite often. Just wait it out, and it will go away. Also, there is are two options – Design/Text – at the bottom right corner of the Design Preview. You can use that to toggle between the design view and the text view. The text view gives you XML code (sort of like HTML). Again, we will use it later.
  5. Component Tree – Use this to see how your layout is nestled. Also, use this to directly select the widgets that are placed on the UI (in the Design Preview).
  6. Properties – This is where you will be able to select the properties of the UI element you have placed. Mostly use it for changing the ID, set the width, height, text and similar properties.
  7. Indexing or status bar – This is your best friend, because you will be looking at this spot a lot of times. You see Android Studio does a lot of things (Only god knows why!) and is constantly doing stuff. This slows down (I have mentioned Android related slowness before) everything but you have no escape from this. The only advice I can give is, always wait for the status bar to become clear before you do anything. Of course, if you have a computer that has like 16 GB RAM or something, you don’t have to worry about it. Then again, if you could afford a 16 GB RAM computer, you won’t be reading this tutorial now would you?
  8. Terminal, Output, Android – This is where you see output from logs. For now, remember that much and keep an eye on this whenever you build the app or run the app. You will discover what this is all about.

Now, we are all up to speed, let’s test if your Android setup is working. Also, if you notice, the project already has hello world in it. So, go back to the Menu (one of the 8 things I have marked in the photo), and select Build. Then, go to ‘Rebuild Project’ and let the IDE do its thing. You should not be getting any errors, if it is does, you should head over to stack over flow.

If everything goes as planned, in the bottom left corner (item 8 on the photo), you will see something called ‘Gradle build finished’. ‘Gradle’ is the tool used by Android to build everything. Once it has finished, you will be able to run the app.

Running the app

There are two ways to run the app.

  1. Using emulator
  2. Using phone

Running the app – emulator

Android Studio comes with its own emulator which will run if your computer is powerful enough. That means, it should support virtualization. Here are some things to remember when trying to get the emulator to work

  • If your computer has 2 GB RAM or less, it is definitely not a good idea to use the emulator option.
  • Usually, ‘Intel Virtualization’, is disabled on most computers. You will have to enable it in the BIOS.
  • After enabling Intel Virtualization, make sure that windows is not using virtualization for its own purpose. In other words, you will have to disable ‘Hyper – V’ on your windows computer.
  • Lastly, after doing all this, you may still get an error about virtualization. If so, download and install the latest version of HAXM. It’s an Intel tool that needs to be installed as well.

Finally, after doing all this, the emulator will run. As with the rest of Android Studio, The Android Studio Emulator is like a giant big Ox. It’s slow and will drive you mad with its launch speed and loading intensity. I am not complaining but simply making an observation. I am telling this to you so that you know what you are getting into here.

Look at the menu, and right below ‘Tool’s, you should see a green colored ‘play button’. Press it, and you should be provided with an option to choose a ‘virtual device’. The first time you do it, you will be asked to create a new ‘virtual device’.

Here are some tips when you are creating your ‘virtual device’.

  • Select a lower resolution such as 480 X 800 or something similar. A lot of android learners try to create a high resolution virtual device, and that will definitely crash the emulator.
  • Select low RAM of 1 GB for your virtual device.
  • In general, select the lowest possible configuration and see if it works. Later, as you get used to android studio, you will know which emulator is the best for you. Of course, if you have a 16 GB RAM and above computer, you don’t need to worry about all this.

Here is the welcome screen you will get when you already have created your virtual device.

If everything has gone as planned, you should see something like this on the bottom left corner.

If you already know some coding, you will notice that there are some command line arguments for netspeed and netdelay. You will learn those things later. Finally, after some serious waiting, you will finally see the emulator running on your PC and it will look like this.

Here are some things you need to remember about the emulator, after it has launched.

  • By default, the emulator will take up your entire screen. IT WILL LOOK HUGE!
  • Also, it will sit right in the center of the screen. That is weird.
  • Even more weird is that, you cannot actually move the emulator away with your mouse. The ‘move’ bar at the top is hidden. To actually move the emulator, you should press and hold SHIFT KEY on the keyboard, and then right click on the emulator on the taskbar (the bar at the bottom of your computer screen). Then, you will get an option to move the emulator and you can finally do that. There, I just saved you so many hours of headache with the huge emulator.
Now, go ahead and unlock the virtual phone with the emulator, and you will see that the app will launch automatically. Sometimes, the app wont launch, in which case, you should simply run the app as described above and it should work.

Finally, here is the default app with Hello World written in it.

Whoa! That was hectic. To keep this post simple, I have skipped a few things. Nevertheless, if you run into any errors or find that I have not explained a particular term, stack over flow is your friend.

That takes care of the basic Hello World. In the Episode 5 – “Hello World – Part 2”, I will modify this project and make it display ‘study nildana’ on the screen. Further, you will also see how to run it on your phone instead of the emulator.

Follow me on twitter, facebook and instagram for more updates. Thanks!

android training – Episode 3 - Setting up your computer

Hello and welcome back. May name is Jay, and I am your trainer for today. We are going to assume that you already went through Episode 1 to 2. Now, it’s time to setup your computer.


Android Studio needs Java to run. There is nothing else to say about that, but to get it from this link.

Download link for Java -https://www.java.com/

Android Studio

One of the good things about Android Studio is that it runs on pretty much any computer. If you have computer that was purchased in the last 4 years, rest assured you will be able to install Android Studio on your computer.

Remember these things when you install and use Android Studio.

  • The file download is huge.
  • During installation, disable the internet connection. Quite a few times, android likes to download updates like crazy for things that you will probably never use. So yeah, please disable internet connection until the installation finishes.
  • If you have used other IDEs (Visual Studio, for example), Android Studio can drive your computer to run extremely slowly.  I mean, really slow. That means, by the time you finish this training program, you will also get degree in being very patient and calm.

Download link for Android Studio –http://developer.android.com/sdk/index.html

Stack Over Flow

This is not a software, but actually a website that I am talking about. If you want to learn more than just what I am teaching here, visit the site here - http://stackoverflow.com/.

Well, that should take care of your computer preparation. Next episode, we start developing with Episode 4 – “Hello World”.

Follow me on twitter, facebook and instagram for more updates. Thanks!

Github general notes

Whenever we provide tutorials (tutorials.studynildana.com), we make sure that we always put the code available for download from GitHub. GitHub is sort of like an online locker where developers can store their code. Then, if they want to, they can open that locker so anybody can see the code. I am sure, I should give a better example, but I am sure you get the idea.

If you are really serious about becoming an expert, check out this book on Git Hub - http://www.git-scm.com/book/en/v2 . It’s free and awesome!

Follow me on twitter, facebook and instagram for more updates. Thanks!

android training – Episode 1 - Welcome

Hello and welcome. May name is Jay, and I am your trainer for today. At study nildana (www.studynildana.com), the idea has always been to help engineering students actually ‘engineer’ something. With that in mind, we decided to take you through the very basics of android development.

I normally like to train students by putting in front of them, an end target. For the sake of this training, I would like to point you to one of study nildana’s app called as ‘alert nildana’. Alert nildana is a location tracking app that can be used by concerned parents as well as friends to keep track of those who are closest, when they are traveling. Think of it like a safety app. You can find more details at the website of this app – alertnildana.studynildana.com

If you want to see how this app works, download the app for your phone on Google Play Store right here.

Get it on Google Play

In this tutorial, we will be using the following technologies

  • Standard Android Stuff
  •  Azure Mobile Services
  • Google Map Services

Under Standard Android Stuff, you will learn the following topics

  • Setting up your computer to develop android apps
  • Creating a simple “hello world” app.
  • Adding new activities.
  • Navigating from one activity to another activity.
  • Collecting input from user.
  • Displaying output to user.
  • Sending values from one activity to another
  • Setting up app icon and app title
  • Deploying ‘Debug’ APK to emulator
  • Deploying ‘Debug’ APK to phone
  • Creating Signed ‘APK’
  • Publishing your app/APK to the Google Play Store
  • Marketing your app to the public

Under Azure Mobile Services

  • Creating an account on Azure
  • Getting the Trial running
  • Activating a suspended Azure trial
  • Creating a mobile services on Azure
  • Connecting the mobile service to your app
  • Inserting data into the mobile service
  • Reading data from the mobile service
  • Deleting data from the mobile service

Under Google Map Services

  • Understanding Fragments
  • Creating Google API for your app
  • Using the API in your app