R is a Java Class file which is autogenerated by Android for your Project. It contains a list of all Resources being used.
For example if you have the following TextView in your Layout
android:text=”Hello Android !!”/>
Android will create the following entry in the R file for this ID.
public static final int helloId=0x7f0c0069;
This helps us to reference this UI component in our Activity Class.
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.
Wireless Charging is one of the most exciting emerging areas.
Startups are trying to address the demand for providing WiFi Charging of Mobile and Wearable Devices.
One such company is Israeli startup Wi-Charge.
Wi-Charge wireless power technology enables unlimited battery life for all things wireless
Continue reading “Phone Charging might be possible using Infrared Laser, thanks to Wi-Charge”
Android devices will become smarter thanks to partnership between Google and chip maker Movidius.
Through the new collaboration, Google will use Movidius’ flagship MA2450 chip to bring deep learning to Android handsets according to ComputerWorld.
Such capabilities could be particularly valuable for vision-impaired users, for example.
Read more here
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”