Android Development Tool
Android Development Tool
To create an interactive and powerful application for android platform. The tools can be
generally categorized into two types.
SDK Tools
Platform Tools
SDK Tools
SDK tools are generally platform independent and are required no matter which android
platform you are working on. When you install the Android SDK into your system, these
tools get automatically installed. The list of SDK tools has been given below −
1. Android:This tool lets you manage AVDs, projects, and the installed components
of the SDK.
2. Ddms: This tool lets you debug Android applications.
3. Draw 9-Patch: This tool allows you to easily create a NinePatch graphic using a
WYSIWYG editor.
4. Emulator: This tools let you test applications without using a physical device.
5. Mksdcard: Helps you to create a disk image (external SDcard storage) that you
can use with the emulator
6. Proguard: Shrinks, optimizes, and obfuscates your code by removing unused
code.
7. Sqlite3: Lets you access the SQLite data file created and used by Android
applications.
8. traceview: Provides a graphical viewer for execution logs saved by your
application
9. Adb: Android Debug Bridge (adb) is a versatile command line tool that lets you
communicate with an emulator instance or connected Android-powered device.
Android
DDMS
DDMS stands for Dalvik debug monitor server, that provide many services on the device.
The service could include message formation, call spoofing, capturing screenshot,
exploring internal threads and file systems e.t.c
Running DDMS
How it works
In android, each application runs in its own process and each process run in the virtual
machine. Each VM exposes a unique port, that a debugger can attach to.
Making SMS: Making sms to emulator.we need to call telnet client and server as shown
below
Now click on send button, and you will see an sms notification in the emulator window. It is
shown below −
Making Call
In the DDMS, select the Emulator Control tab. In the emulator control tab , click on voice
and then start typing the incoming number. It is shown in the picture below −
Now click on the call button to make a call to your emulator. It is shown below −
Now click on hangup in the Android studio window to terminate the call.
The fake sms and call can be viewed from the notification by just dragging the notification
window to the center using mouse. It is shown below −
Capturing ScreenShot
You can also capture screenshot of your emulator. For this look for the camera icon on the
right side under Devices tab. Just point your mouse over it and select it.
As soon as you select it , it will start the screen capturing process and will capture whatever
screen of the emulator currently active. It is shown below −
The eclipse orientation can be changed using Ctrl + F11 key. Now you can save the image or
rotate it and then select done to exit the screen capture dialog.
Sqlite3
Sqlite3 is a command line program which is used to manage the SQLite databases created by
Android applications. The tool also allow us to execute the SQL statements on the fly.
There are two way through which you can use SQlite , either from remote shell or you can
use locally.
From a remote shell, start the sqlite3 tool by entering the following command −
sqlite3
Once you invoke sqlite3, you can issue sqlite3 commands in the shell. To exit and return to
the adb remote shell, enter exit or press CTRL+D.
Start the sqlite3 tool from the /tools directory, specifying the database file −
sqlite3 <database-file-on-host>
Platform tools
The platform tools are customized to support the features of the latest android platform.
The platform tools are typically updated every time you install a new SDK platform. Each
update of the platform tools is backward compatible with older platforms.
Here are some steps to build your first Android app using Android Studio:
Here are some other steps you can take to launch your app: Create a website with information
about your app, Establish a pricing approach, and Improve user experience.
Here are some steps you can take to launch an app successfully:
3. On the Target Android Devices dialog, specify the API level and target platforms. As
mentioned earlier, Android is for more than just phones, though for our purposes we
will simply select the Phone and Tablet form. Then, click Next.
4. On the Add an Activity to Mobile dialog, select the Empty Activity type. Then,
click Next. This will create a default application ready to be built and run directly
from Android Studio.
5. On the Configure Activity dialog, name the files for the application.
package com.navitend.saysomething;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;
import android.widget.EditText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
);
btnMapMe.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(mapIntent);
}
}
);
}
}
Resources in Android are organized into a subdirectory of the project named res, as described
previously. Resources fall into a number of categories. Three of these categories are:
Drawables - This folder contains graphics files, such as icons and bitmaps
Layouts - This folder contains XML files that represent the layouts and views of the
application. These will be examined in detail below.
Values - This folder contains a file named strings.xml. This is the primary means for
string localization for the application. The file colors.xml is useful for defining color
codes used by the application. This file is analogous to a css style sheet for those
familiar with web programming techniques.
Primary
The sample application contains a single activity and a single view. The application contains
a file named main_activity.xml that represents the visual aspects of the primary UI of the
activity. Note that there is no reference in the main_activity.xml where the layout is used.
This means it may be used in more than one activity, if desired. See the following code listing
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="301dp">
<Button
android:id="@+id/hitme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hit Me!"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="383dp" />
<Button
android:id="@+id/mapme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Map Me!"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="460dp" />
</LinearLayout>
<TextView
android:id="@+id/thelabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Hello World, Say Something!!!!!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/etLatitude"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Latitude"
android:inputType="numberDecimal"
android:text="40.9241164" />
<EditText
android:id="@+id/etLongitude"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Longitude"
android:inputType="numberDecimal"
android:text="-74.7213913" />
</LinearLayout>
To build the application, select the wrench icon (looks more like a hammer to me) in the
menu of Android Studio.
The build process, as introduced earlier, is a multi-step process that may be customized for
any particular application. For this tutorial, we do not modify the build process. The output of
the build process should look something like this:
Now that the application has compiled successfully, it's time to run the sample application.
Earlier in this tutorial the AVD Manager was introduced as the means for configuring the
emulator for testing applications without the need for a real device. Running an application
by using the emulator is particularly useful because it permits testing without the need to
purchase numerous costly devices.
If there are connected devices, each shows up in the drop-down below Connected Devices.
Alternatively, select from one of the available Virtual Devices. In the previous figure, there is
a single AVD defined entitled Nexus One API P. To create a new AVD, select the Create
New Virtual Device button.
Finally, click OK to launch the application on the selected deployment target. The AVD or
emulator launches with our sample application running on it.
IDEs can help improve a developer’s productivity, code quality, and overall development
experience.
Productivity: By combining common activities such as editing code, building
executables, debugging, and testing as part of software/application development,
IDEs help by reducing time and increasing overall productivity.
Code Quality: IDEs come with built-in tools as a part of a single GUI, through which
developers can execute actions without switching between applications. Furthermore, it
can also help in Syntax highlighting, code refactoring, and code analysis boosting
overall code quality.
Integrated Environment: IDEs come pre-built with a combination of development
tools that allow developers to start programming new applications quickly. With
IDEs, it is no longer necessary to manually configure and integrate numerous utilities as
part of the setup procedure. Additionally, since every utility is available on the same
workbench, developers don’t have to spend hours learning how to use each one
separately.
Customizability: By incorporating customization options ranging from custom color
schemes, and keyboard shortcuts, to choosing unique layouts, different plugins, and
add-ons; IDEs enable developers to customize their environment to their unique needs
and tastes, improving the comfort and efficiency of the development process.
Types of IDEs
IDEs come in various forms, some are designed to work for a specific language whereas
some are targeted to a particular platform like mobile devices. Hence, it becomes equally
important to choose an IDE best suited to one’s needs.
1. Desktop IDEs
This type includes the IDEs that can be configured locally. They do not need an active
internet connection to build/run programs. Desktop IDEs are highly customizable to suit
developer-specific needs and provide performance irrespective of the internet
speed. Examples: include Microsoft Visual Studio, Eclipse, Netbeans, etc.
2. Cloud IDEs
Cloud IDEs eliminate the overhead of configuring the software locally. They run on remote
servers and can be accessed through desktop browsers. Cloud IDEs provide better
accessibility and platform independence making them accessible through the Internet
Irrespective of the Client Operating System. Cloud IDEs can be used freely or can have
pricing models with respect to the provider. Examples: Include Gitpod, AWS Cloud 9,
Replit, etc.
3. Mobile App Development IDEs
These IDEs are specially designed for creating mobile applications. They include features
like Emulator support and integration for developing and testing mobile applications.
Mobile Development IDEs can be in the form of Desktop IDE or Cloud
IDE. Examples: Include Android Studio, Flutlab.io, etc.
4. Database-Specific IDEs
These IDEs (Integrated Development Environments) are specially designed for working
with databases. They include features like query builders and n for developing and testing
mobile applications. Like mobile-development IDEs, Database IDEs can also be in the form
of Desktop IDE or Cloud IDEs. Examples: Include MySQL Workbench, Oracle SQL
Developer, etc
https://www.jetbrains.com/help/idea/2023.3/using-breakpoints.html#breakpoint-properties
Android Studio provides a debugger that lets you do the following and more:
Select a device to debug your app on.
Set breakpoints in your Java, Kotlin
Examine variables and evaluate expressions at runtime.
Debug code
During a debugging session, you launch your program with the debugger
attached to it. The purpose of the debugger is to interfere with the program
execution and provide you with the information on what’s happening under the
hood. This facilitates the process of detecting and fixing bugs in your program.
Before Debugging
1. Make sure the Generate debugging info option is turned on (the default setting) in Settings |
build, Execution, Deployment | Compiler | Java Compiler.
This setting is not absolutely required for debugging, however, we recommend leaving it
enabled. Disabling it allows you to save disk space at the cost of some debugger
functionality.
If you are new to debugging, the out-of-the-box configuration will work for you. The topics
about each debugger functionality provide references and explain the related settings where
applicable. If you are an advanced user and looking for some particular property, see
the Debugger reference section.
1. Define a run/debug configuration if you are going to use a custom one. This is required if you
need some arguments to be passed to the program or some special activity to be performed
before launch.
Just like with regular running of the program, you can run multiple debugging sessions at the
same time.
3. After the program has been suspended, use the debugger to get the information about the state
of the program and how it changes during running.
The debugger provides you with the information about variable values, the current state of
the threads, breakdown of objects that are currently in the heap, and so on. It also allows you
to test your program in various conditions by throwing exceptions (for example, to check
how they are handled) or running arbitrary code right in the middle of the program execution.
While these tools let you examine the program state at a particular instant,
the stepping feature gives you the control over step-by-step execution of the program. By
combining the tools you can deduce where the bug is coming from and test your program for
robustness.
4. When you have determined what needs to be fixed, you can do it without terminating the
session. For this purpose, IntelliJ IDEA provides a functionality allowing you to adjust and
5. reload pieces of your code on the fly. This approach is covered in the Reload modified
classes topic.
Breakpoints
Breakpoints are special markers that suspend program execution at a specific point. This lets you examine the program state
and behavior. Breakpoints can be simple (for example, suspending the program on reaching some line of code) or involve more
complex logic (checking against additional conditions, writing log messages, and so on).
Once set, a breakpoint remains in your project until you remove it explicitly, except for temporary breakpoints.
Types of breakpoints
The following types of breakpoints are available in IntelliJ IDEA:
Line breakpoints: suspend the program upon reaching the line of code where the breakpoint was set. This type of
breakpoints can be set on any executable line of code.
Method breakpoints: suspend the program upon entering or exiting the specified method or one of its
implementations, allowing you to check the method's entry/exit conditions.
Field watch points : suspend the program when the specified field is read or written to. This allows you to react to
interactions with specific instance variables. For example, if at the end of a complicated process you are ending up with an
obviously wrong value on one of your fields, setting a field watchpoint may help determine the origin of the fault.
Exception breakpoints: suspend the program when Throwable or its subclasses are thrown. They apply globally to
the exception condition and do not require a particular source code reference.