prashanth updated resume 2024 for Teaching Profession
How to create ui using droid draw
1. Android Application Development Training Tutorial
For more info visit
http://www.zybotech.in
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
2. How-to create UI using DroidDraw
Introduction
Now the we know more about the components of an Android Application let me introduce you to a new
element we can work with: DroidDraw.
http://www.droiddraw.org/
This is a User Interfaces designer/editor for Android written in Java. With this application (we can work on-line
or on our desktop). We can also download it for Linux, Mac or Windows.
Once we have it in our desktop, it's time to have a look a it.
In the left side we can see a rectangle area, like our phone screen. This is the place where we are going to
“draw” our UI. Above this screen we can see two values:
Root Layout -> Here we can set which is going to be the root layout of our UI. It can be a LinearLayout,
AbsoluteLayout, RelativeLayout, ScrollView o TableLayout. So this is our first container of elements we are
going to use.
Screen Size -> Here we can choose the size of our Screen, as if we had different kinds of mobile phones and
different screen sizes.
In the right side, we have, now, lots of widgets, that’s because we are on the “widgets” tab. We can see the
names of the others tabs.
Layouts
Properties
Strings
Colors
Arrays
Support.
In the lower right side we can see the output of our creation. Here, we can generate the XML code from the UI
we have create in the left side. In other hand, we can write our own XML code and loaded it to the Screen. This
is a good way of testing the XML parameters to get familiar to them.
We are going to use the most important ones (in my point of view). Lets have a look at them.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
3. Widgets Tag
In this tab we can find most of the widgets we can use with an Application: Buttons, Checkboxes,
RadioButtons, Images, Galleries…
To use them, just drag one of the elements and drop it on the left side of the screen. The element will be placed,
depending of which “Root Layout” we are using. For example, if we are using “LinearLayout” It will be placed
in the top side of the screen. In the other hand if we are using "AbsoluteLayout" we can place it wherever we
want. To learn more about layouts, please visit this article:
How-To Create User Interfaces (UI) Using XML: Layouts
Introduction
There are two ways to create user interfaces for applications in Android. We can create them using Java code
and classes and in the other hand, we can create our UI using XML. In this section we will see how to create
them using the last way.
If you remember Part 3 of this series of articles, when we create a new Android Project in Eclipse,
automatically an structure is built. We learned that the Main Activity is the entry point of the application. But,
this file is nothing by itself. Its needs something to be drawn on it. So we start drawing views and groupviews
over this Activity.
We will create layouts and we will add widgets to this layouts. A layout is something like a container. A layout
can hold as many widgets as we want. A widget is a single element as a Button, a Image or a CheckBox.
All this XML codes will be stored inside the res/layout folder.
Layouts
As we said before, lets start talking about the widgets containers or layouts.
There are lots of kinds of layouts, depending of its characteristics and properties. Lets see the most important
ones.
LinearLayout
In LinearLayouts we can add children in one direction. We can add them horizontally or vertically (depending
the property we have set on the LinearLayout). The next images will show you more clearly what I was talking
about.
Here we see four buttons inside a LinearLayout set vertically.
Here we can see the same four buttons but now horizontally.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
4. This is the XML code for a LinearLayout.
Inside the tags <LinearLayout> and </LinearLayout> is the place where we put the widgets. As we see, this
code has some properties. Lets have a look at them:
android:layout_width → Defines the width of the Layout. The values it can hold are:
fill_parent → The layout fill al the parent width, if there is no parent, it will fill all the screen
wrap_content →Depending on the content of the layout, the width will be fixed to it
Xpx → Where X is a number. You can determine the width of our layout in pixels
android:layout_height → The same as the “layout_width”, but considering the Height of the layout
android:id → This string is consider the identifier of the layout. When we have more than one layout or
widget, its interesting to have them identified.
android:orientation → this is the parameter we were talking before. Here we can change the orientation of the
layout: horizontal or vertical.
All layouts that are we going to see next are similar to the LinearLayout. They only change in the way of
displaying the widgets.
AbsoluteLayout
With this layout, we can put the widgets wherever we want, just with the coordinates. Considering that the
point (0,0) is in the top-left.
RelativeLayout
In the RelativeLayout, we set the place of the widgets in relation to others widgets or the parent. Here it is
important the “android:id” parameter.
For example. If we have a button in the middle of the screen, we can add other widget 10px to the right of this
initial button.
TableLayout
We can set the position of the widgets in rows and columns. The TableLayout holds TableRows elements. Each
of this TableRows can hold one or more columns.
Other Layouts parameters
To finish this article we will see some other Layouts parameters that can be used in some of the layouts showed
above. Some of this parameters are used in the widgets too.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
5. android:gravity → With this parameter specify the place of the object inside a bigger container. For example a
LinearLayout inside the screen. It can have some values:
-top → Puts the object on the top of the container
-bottom → Puts the object on the bottom of the container
-center → Puts the object on the center of the container
-right → Puts the object on the right of the container
-left → Puts the object on the left of the container
android:background → You can set the background of the layout, it can be a picture (drawable resource) or a
color, #FFFFFFFF
android:visibility → With this parameter we can control the visibility of the layout. It can be
-visible → visible on the screen
-invisible → not visible but It takes account in the layout disposition.
-gone → The same as if you didn't have use this layout.
Activities
An Activity is a single screen of the User interface. This Activity can hold a hierarchy of views to give the UI
the functionality it needs. For example, an email-application. We can have two Activities, one to list all the
mails we have received (and to interact with them) and other Activity to write and send an email. Both Activities
are related, but they work separately in their own.
Services
A Service runs in the background, it doesn’t have UI. An example of Service can be a system that notifies the
user when a sms or an email has been received in the mobile.
Content providers
With the content provider we can access to any data stored in the device form other applications or even form
our applications. This data can be stored in files or is the SQLite database.
Layout
Layouts are containers of elements in the User Interface. Every time we define a .xml file with a specific user
interface, we need to use this elements to hold hierarchy view tree. As I have wrote in other article, we can find
different layouts kinds, depending its properties and relationship with the elements its holds. Layouts can be
nested one inside other.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
6. View
A View is a single object of the user interface. This Views are placed inside the Layouts and with them we can
create from the most simplest UI to the most complex one. Android give us the choice to work with XML to
create UI, this is a good way to separate functionality from User Interface. Views can be Images (ImageView),
Text (TextView)…
Events (On click, onTouch)
We have to define the events listeners to capture this events.
An Event is something that happens form the “outside”, is something we don’t control, something we don’t
know when its going to happen. For that we use the Events controllers, for each event that can happen, we can
define how the system is going to behave. A common event is onTouch Event, this is when the screen is
touched. We have to define the events listeners to capture this events.
Resources
Resources are the external elements we use in our applications. They are placed in the “res” folder and they can
be, images, music, videos. Here, in this folder is stored the .xml files: User Interfaces, styles, strings we use in
the App, themes… Once resources are compiled, they are fully avaliable in Java code using the "R.java" file.
We will see this in further examples.
Layout Tag
This tag is simple, we just have the Layouts (containers) and we can place them inside the screen. In this way, a
Layout can hold too much more layouts inside, so we can create more complex structures.
Properties Tag
Depending on which element we have selected on the left Screen, the Properties screen will change. Here we
can see and edit the parameters of each element. Its very intuitive, we just have to change values in the
InputBox. You can play with values to see how they affect to the layouts and the elements in the Screen. One
we have change something and want to see it on the screen, just press the Apply button.
String Tag
In this tag we can add Strings. This strings can be used in our UI. We can reference them from other parts of
the application. Instead of writing them manually we just made reference to a String we have create before.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
7. How-to use Dalvik Debug Monitor Service (DDMS) Tool With
Google Android
Introduction
If we had installed the Eclipse plugging properly (if not, please go to “Setting the environment”), we could
access to the DDMS perspective. On your Eclipse menu bar, click on “Window” and then on “Open
Perspective”. Search for the DDMS perspective. We will see a screen like this one we have in the picture.
Now, lets have a look to all the elements we have here.
Devices
In the top left window we can see a tab with the label “Devices”. Here we can find all the devices/emulators
that are “Online” and connected to Eclipse. Below each instance of the Emulator or device, we have all
processes that are running in this instance, each process runs in its own Virtual Machine and we can identify
them by the package name of the application it host. In the most-right column we find the ports where this VM
are connected. And just in the left of the processes name, there is other number, this is the “Linux process ID”.
Every Linux process has its own unique identification, as Android is based on Linux kernell, we find the same
process systems here.
In this same window, we find some icons in the top side of it.
From left to right.
--The “bug” icon, represents the debugger state. If its green, we are connected to the debugger and we can do
debugging task. If it is red, we are disconnected from the debugger.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
8. --The multiple-rows icon, just activates the “threads visualization”, if we select a process and we click this icon,
in the right panel, in the tab “Threads” we will see the info, state and actualization times of the threads running
in this process.
--The bucket-like icon. Has more or less the same functionality than the “Update Threads” icon. In this case we
update the heap memory usage of this process. Clicking on it we update this information in the right panel.
--The stop icon, is just as easy as, stop the selected process.
--And to finish talking about this icons, we find the “Get screenshot” icon, with this, we can have an
instantaneous picture of our device/emulator screen.
Emulator Control
In this panel, we find some emulator options (this only works when we are working with the emulator, not with
real devices). Here we can simulate incoming calls, SMS for testing purposes. We can set the “Location
coordinates” (Latitude, Longitude) like a GPS.
Logs and ouputs
In my point of view this is the most important panel of DDMS. Here we can do debugging and tracing task, in
case we have problems with our application.
In the “LogCat” tab, we have all messages from the device, most of them are incompressible, but here we can
find Exceptions messages and Messages we add in the Android code using the Log.i(“Title”,”Message”) class
to display “information” messages. If we want to display “Error” messages it would be something like
Log.e(“Title Error”, “Error”).
In the “Console” tab, we find other kind of messages. This are related to the changes of states and applications
in the phone. When a Application is installed, or when we start the device/emulator, messages showing that
information will be displayed here. If we find connectivity problems, here will be shown this kind of errors too.
The Outline and Properties tab, shows information about the application: classes, attributes, variables...
File Explorer, Heap and Threads
In the last panel, we find three tabs, Threads, Heap and File Explorer. The Threads and Heap tabs are just the
information displayed from the first panel when we check the “Update Threads” and “Update Heap” buttons.
Here the most important tab is the File Explorer. With this, we can access to the device/emulator file system,
we can push files into it, get files from it and delete them (Using the top-right icons). At the right of the file
names, we can find the last update date, and the permissions of this file/folder (Using Unix system, again)
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
9. How-To Work With Google Android Databases
Internal Databases
For this Google Android instructional guide we will work with Android internal DataBases. Android supports a
SQLite database system.
In Android, data from applications is stored in a database system. Every application has its own database. The
point of this Article is to get to the database file, in other articles we will see how to work with them inside the
Apps.
Hint! → As far as I could research, we can only have database files from the Emulator. In real devices they
may be locked. So this would be useful to know more about the Android internal system.
Lets have a look at one of this databases.
To access the database we have to go to the DDMS perspective in Eclipse once an emulator is running. As I
explained in one of my past articles on the left side panel we can find the “File Explorer”, here we can surf
around the Android file system. We can see 3 folders:
-Data -> Application data
-SDCard -> File system inside the SD card (if any).
-System-> Core file system.
In the “data/data” path, we will find a list of packages, most of these packages store data in the internal
database. Lets have a look towards the “com.android.alarmclock” package. Inside of it, we can find the folder
“databases” and inside of this folder, the “alarms.db” file.
We pull the file from the device, click on the “disk-and-arrow” icon. Now, we have the database file out of the
emulator. Its time to see whats inside on it.
For this purpose we will need an external tool to open the .db file.
Looking at http://www.sqlite.org/cvstrac/wiki?p=ManagementTools we can find lot of tools to work with
SQLlite. I prefer GPL-licensed ones, like:
http://sqliteman.com/
or
http://sqlitestudio.one.pl/index.rvt
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
10. I will use QSLitestudio for the purpose of this article.
Now we can find the alarm.db file via our computer from the QSLitestudio and then open it.
It should look something like this.
Here we can see the tables, fields and values of the “alarm.db”. In this case, we can see the hours that the alarm
is set to in the Emulator.
How to Install APK files on your Google Android Phone
How to Install APK files on your Android Phone
Android is one of the most promising mobile platforms currently available on the market. More than 100 new
Android smartphones are expected in the coming year. Here's a list of the Top 10 Android Smartphones. One
of the best features of the Android OS is the availability of third party applications.
There are two ways to install third party applications on your Android based phones:
The first way is by installing applications through the online Android Market, which we have already
covered.
The second way is to manually install APK applications developed using the Android SDK on your
Android phone.
APK applications are basically Android package applications.
Through the Android Market
To install APK applications on your Android phone do the following:
1. Copy the APK file you want to install to your phone's memory card and insert the card into your
Android phone.
2. Go to Android Market and search for the Apps Installer application.
3. Open it and click on the Install button.
4. After it is installed, just open it. It will show you all the APK files stored directly in the root directory of
your memory card.
5. Just click on the application you want to install and it will be installed.
Using the Android SDK
There is one more method that can be used, you can install APK files into your phone using the Android SDK.
Download the Android SDK.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
11. First of all, install the Android SDK on your computer. You will also need to install the Android USB drivers to
connect the SDK to your phone via USB. You can download it from here -
http://dl.google.com/android/android_usb_windows.zip .
To install applications from other sources, you also need go to Settings -> Application Settings and enable
Unknown Sources. Also go to Settings -> SD Card and Phone Storage -> Disable Use for USB Storage. You
can enable it again later.
Next, just open Command Prompt and type: adb install path/file.apk
where path is the full path to the APK file and file is the name of the APK application file. Your application is
now installed. This is all you need to do, now just open the application on your phone and use it.
How To Install and Remove Apps on Android Phones
How do you install and uninstall applications on an Android phone? We'll show you how.
The primary and most used way to install applications on your Android based phone is by using Android
Market. The Android market is a centralized repository of all the applications developed for Android. It has
been modelled after the very popular Apple iPhone AppStore. Check out this comparison between iPhone
Appstore and the Android Market. Third party developers can upload their applications on the Android
market and then anyone can download them. Most of the applications are free but some are also paid.
How to Install Applications
To install applications using Android Market perform the following steps:
Open the Android Market application in the Applications menu.
You can select any option - Applications, Games, Search or My Downloads based on what you want to
do. You will then get a list of applications or games to choose from.
You can also search for any particular application. You will then get a list of apps with their description
and rating.
Click on the application you want and you will get more details of that application - the number of
downloads and user comments.
To install it, just click on the Install button on the bottom of the screen.
In the next screen, it will give you more details about the application including the different
functionalities it will need to access. Just click on OK to finish installing the application.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
12. You can also Install APK files on your Android phone directly.
Using the Application
You can rate and even leave a comment on the Android Market about the application.
To access the application, just go to your Menu and select the application you want to launch.
To check a list of all the applications you have downloaded, open up Android Market again and select the My
Downloads option.
Check out some cool Android applications to install.
How to Remove Applications
To uninstall applications that you installed using the Android Market:
Open the Google Android Menu.
Go to the Settings icon and select Applications.
Next, click on Manage.
You will be presented with a list of applications you have installed.
Select the application you want to uninstall, and click the Uninstall button.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi