Using Log statements in your Android Project is both useful and important. It will help you to debug problems.
The following Log levels are available in Android
To add a Log statement to your MainActivity Class simply add the following code statement to the onCreate method.
Log.v(MainActivity.class.getSimpleName(), “In onCreate”);
In the last
Article you learnt about MainActivity class. Let’s look at the Layout XML file.
The Layout file is responsible for the User Interface (UI). It’s what you see when you Launch an App.
The File can have Text, Buttons and other elements. Just like a website.
Go ahead an open the content_main.xml file in the new Project. As you can see this XML file contains two primary XML tags:
1. RelativeLayout : This Element tells Android to put elements relative to each other.
2. TextView : This Element is used to display Text.
The android:text attribute in the TextView element is used to display Text. Go ahead and modify this. Save and test. In the next Video we will add a Button to this Layout file.
In the last video you saw the
Android Manifest File.
Let’s look at the
MainActivity class. The MainActivity class is called when you Launch the App.
This Class is an Activity. Now you might be wondering what is an Activity. An Activity is used to peform certain basic setup tasks when the App Launches. Like specify the Layout
which the App will use. All activities should extend Activity class and implement the onCreate method which gets called when the activity object gets created.
I hope this gives you an idea about the MainActivity Class. We will look at the activity life cycle a little later. In the next video you will see the Layout file. Until next time, bye.
Now that you have a basic Android App and have been able to run it in the
Emulator. It’s time to look at the Manifest file.
The Manifest file is used to define your App settings. Like Name of the App, the App Theme, Launcher Icon, Activities and more.
The important thing to understand is the definition of the MainActivity. The MainActivity class is used by Android when your App Launches.
It’s time to run your App using the Android Emulator. I have recorded a Video Tutorial to guide you through this process.
In the last
Article you got an overview of Git and GitHub.
The following Video Tutorial will help you to connect your Android Project to GitHub.
GitHub is a great way to not only maintain your Code Versions but also to showcase your Work and Collaborate with others.
Source Code – https://github.com/ankur-srivastava/HelloAndroid
Now that you have created a Basic Android Project it’s time to start using Github.
But before that what is Git and GitHub ?
Here is a Video where I talk about Git and GitHub
Github is a place (actually a website) where people manage, share and showcase there Project Source Code. Or for that matter any kind of Code or Documentation.
At its Core it uses Git.
Now what’s Git ?
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency
Continue reading “Android Basics – Overview of Git and Github”
In the previous
Article you created a simple Android Project.
Once that is done you might want to take a look at what all Folders and Files have been generated.
The Android Studio generates some XML files and some Java Class files. Lets look at few of these files:
Continue reading “Android Basics – A look at the Android Project Structure”
Enough of talking, let’s create a Simple App. I hope you have Android Studio installed. So go ahead and launch it.
You can either follow the Post below which details the Steps or View this video
Refer to the images for the below Steps.
Android App Step 1
Android App Step 2
Android App Step 3
Android App Step 4
Android App Step 5
Android App Step 6
Continue reading “Android Basics – How to Create your first App”
Now that you got some idea about the
Android Platform, let us look at the tools and development environment Android provides.
Android provides an Integrated platform to help Create, Build, Test and Package Apps.
Continue reading “Android Basics – How to setup Android Development Environment”