0% found this document useful (0 votes)
5 views12 pages

Android Programming Error Correction Guide

Activity 1 presents a report on the introduction to programming for Android, identifying the necessary tools such as Android Studio, SDK, and Java. A simple application is developed to display text on the screen, and syntactic errors found in the code are corrected. Finally, the application runs successfully in the emulator after making the necessary corrections.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views12 pages

Android Programming Error Correction Guide

Activity 1 presents a report on the introduction to programming for Android, identifying the necessary tools such as Android Studio, SDK, and Java. A simple application is developed to display text on the screen, and syntactic errors found in the code are corrected. Finally, the application runs successfully in the emulator after making the necessary corrections.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Raúl Emilio Blanco Vela

149613

Group: CC81

Subject: Mobile Computing

Teacher: Mtra. Landy Blanquet Escobar

Activity 1. Android Programming

Tenosique
Objective

Identify and correct the error in a small code in the programming environment
Android.

Type of activity

Report (learning activity 1)

Instructions

Based on the key readings and notes, please do the following:

1. Install
Android Software Development Kit (SDK) on your computer
You must previously install Java or JDK (Java Development Kit)
And the environment for development will be in Eclipse

2. In this example, you will be shown some key instructions for the developments,
HELLO ANDROID

Support: Lo what makes the last instruction del program anterior


setcontentview([Link]) is to 'inflate' the screen view (or 'layout').

This view is defined in the [Link] file, which is referenced by the variable.
[Link].

1
The string of text intended to be displayed on the screen is defined in this xml file.
through TextView android:text=" Hello Android".

Capture, identify, and correct the error.

The result of running this project in the Android emulator is the following:

3. Finally, each step taken must be documented. Likewise, send the


image of what has been done.

2
Introduction

In activity 1, a report will be presented which aims to provide an introduction.


to the field of programming for Android, introducing the necessary tools
for the development of mobile applications, such as the IDE, SDK, and Java.

As requested by this activity, an example of a simple application will be made.


in such a way that it displays a phrase on the screen, likewise, it will be raised the
source code and key instructions to correctly implement the application.

Figure 1. Android logo.

3
Development

For said activity, we are asked to use the following tools for the
development of a mobile application

Java or JDK
Android Software Development Kit (SDK)
Eclipse (Graphical Environment)

However, for this exercise only the first two points will be used, since
currently the SDK provides us with the new graphical environment (Android Studio) this
replacing the Eclipse IDE.

That said, to begin the technical process of installation and development of


mobile applications require certain tools such as the graphical environment,
In this case, Android Studio will be used, which is a unified build environment.
development in which we can create applications not only for mobile phones or tablets, but
with the great technological advancement, smartwatches can also be made
smart televisions.

This IDE works using the Java language since Android applications are
executed on the Java virtual machine, therefore, for the correct functioning
From the same we need the JDK tool.

Android Studio & Eclipse

Although initially, Eclipse (called ADT - Android Development Tools) was


the software development environment (IDE - Integrated Development Environment),
Google has stopped maintaining it and the Android Studio environment has become
the official tool for creating applications for Android. Therefore, Google
abandon the development of Eclipse - ADT. Android Studio is based on IntelliJ
IDEA. This IDE is cross-platform, allowing for easy installation.
both on Windows and on Linux or Mac. (Robledo, 2017)

Java or SDK

It is very important to keep in mind that, in order to run the development environment
Android Studio, it is necessary to have the development library installed on the computer.
from Java. (Robledo, 2017)

4
Verification of tools

It is confirmed that the previously installed tools are available.


team.

Figure 2. Installed tools.

Creation of the application

We proceed to open Android Studio as shown in figure 3.

Figure 3. Android Studio.

5
We create a new project named 'Activity1' with the configuration in
Java language and selecting API 23: Android 6.0 (Marshmallow), this selection gives us
it allows the application to run on 94.1% of devices. (Figure 4)

Figure 4. Creation of the application.

Once the project is created, the graphical interface will be launched to develop the application.
in question and where it shows us a basic default template, which provides us with a
idea of how to start developing the app. (Figure 5)

Figure 5. Development interface (Android Studio).

Android Virtual Device (AVD)

6
In order to test the Android applications we develop without the need
Having an Android phone, the SDK includes the possibility to define a Device
Android Virtual Device (in English, AVD). This device emulates a
terminal with Android installed. (Robledo, 2017)

It is for this reason that we proceed to generate or create the AVD in the AVD section.

Manager, which will open a window where it gives us a list of devices.


virtuals created and a button where it allows us to create it. (Figure 6 & Figure 7)

Figure 6. ADV Manager.

7
Figure 7. Generating the AVD.

Requested codes in the activity

The activity asks us to identify and correct the errors found in the syntax.
from the codes provided by it.

We proceed to present the before and after, marking the correction that was made, these
marked with yellow, as shown in the following tables:

Code #1

Before After
public class Hello extends Activity { public class Hello extends Activity {
Called when the activity is first
created. created.
Override Override
public void onCreate(Bundle public void onCreate(Bundle
savedInstanceState) { savedInstanceState) {
[Link](savedinstanceState); [Link](savedinstanceState);

8
setContentView([Link]) setContentView([Link]);
} }
} }

Code #2

Before After
<xml version="1.8" encoding="utf-8"/> <xml version="1.8" encoding="utf-8"/>
<LinearLayout xmlns:android= <LinearLayout xmins:android=
[Link] [Link]
android android
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
> >
<TextView TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
Hello Android Hello Android
> />
</LinearLayout> </LinearLayout>

Upon closely examining the codes, we notice that there are errors in the syntax. In the first
code we see that it is for not writing or putting the ';', this is of utmost importance since
it means that the sentence has been completed and it is the time for the beginning of another, if there is one

existence of any other.

Something similar happens in code #2, since “/>” is not put, causing it not to give a
closes the statement and the graphical environment informs us of a syntax error and the application does not

can be executed.

Once these syntax errors are fixed, we can proceed to run the application in
the previously generated and configured emulator. This resulting in the
correct compilation of the application, as shown in figure 8.

9
Figure 8. Successful compilation of the application.

10
Bibliography – Sources Consulted

eBook
of Education and Vocational Training of Spain. Retrieved on May 14
2022, ofUnable to access the content from the provided URL.

eBook. Montero Miguel, R. (2014). Development of applications for Android. Paracuellos


from Jarama, Madrid, RA-MA Editorial. Retrieved on May 14, 2022, from
Unable to access the content of the provided URL.

eBook
Ministry of Education and Vocational Training of Spain. Retrieved on the 14th of
May 2022, ofUnable to access the link provided.

11

You might also like