Android Programming Error Correction Guide
Android Programming Error Correction Guide
149613
Group: CC81
Tenosique
Objective
Identify and correct the error in a small code in the programming environment
Android.
Type of activity
Instructions
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
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".
The result of running this project in the Android emulator is the following:
2
Introduction
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.
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.
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
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)
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)
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.
7
Figure 7. Generating the AVD.
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
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
Ministry of Education and Vocational Training of Spain. Retrieved on the 14th of
May 2022, ofUnable to access the link provided.
11