- Lesson1: Installing tools to program for Android with Kotlin
- Lesson2: Steps to Create the First Project in Android Studio with Kotlin
- Lesson 3 – Capture the click of a button in Kotlin
- Lesson 4: RadioGroup and RadioButton Controls with example
- Lesson 5: How to implement CheckBox Control and example
- Lesson 6 – Control Spinner with examples
- Lesson 7: ListView Control (with a list of String) with examples
- Lesson 8 – Control ImageButton
- Lesson 9: Simple Notifications using the Toast class and example
- Lesson 10 – Control EditText and example
- Lesson 11 – Launch a second “Activity” – example
- Lesson 12: Launch a second “Activity” with Values (parameters)
- Lesson 13 – Store Data Using the SharedPreferences Class
- Lesson 14 – Storing data in a text file in the internal memory
- Lesson: 15 – Store(Save) data in a text file on an SD card
- Lesson 16 – Store (save) data in SQLite database
- Lesson 17 – Installing Android App on a real device
- Lesson 18 – Layout (LinearLayout) in Kotlin Example
- Lesson 19 – Layout (TableLayout) in Kotlin Example
- Lesson 20 – Layout (FrameLayout) Example in Kotlin
- Lesson: 21 – Layout (ScrollView and LinearLayout) in Kotlin
- Lesson 22 – Application icon in Kotlin
- Lesson 23 – Audio playback (file in raw folder) in Kotlin
- Lesson 24 – Play, Pause, Resume, and Stop an Audio file in kotlin
- Lesson: 25 – Audio playback (file from SD card) in Kotlin
- Lesson 26 – Audio playback (file from internet) in Kotlin
- 27 – Playing audio using your own Android player (via Intent) in kotlin
- Lesson 28: Record audio using Android recorder (via Intent) in Kotlin
- Lesson 29: Record audio using the MediaRecorder class in Kotlin
- Lesson 30 – Draw: graphing pixels in kotlin
- Lesson 31 – Draw: draw background and draw lines in Kotlin
- Lesson 32 – Draw: rectangles in Kotlin
- Lesson 33 – Draw: circles in kotlin
- lesson 34 – Draw: ovals in Kotlin
- Lesson 35 – Draw: text in kotlin
- 36 – Draw: text with external font style in kotlin
- Lesson 37 – Draw: text on a path in kotlin
- Lesson 38 – Draw: an image in kotlin
- Lesson 39 – Touch event: draw a circle in kotlin
ContentsDownload tools needed to program for Android with Android Studio and Kotlin language Download tools needed to program for Android with Android Studio and Kotlin la…
Once we start the Android Studio environment the main dialog appears: We chose the option “Start a New Android Studio project” Now a series of windows will ap…
Make a program that allows the loading of two integers in controls of type EditText (Number). Display within the same EditText controls messages that request loading values. Have a Button to add the two values entered. Display the result in a TextView type control.
The goal of this concept is to practice implementing a program that requires RadioButton type controls to select an activity. We will learn how to group a set of RadioButton and verify which one is selected.
The objective of this concept is to continue practicing projects with Android Studio and incorporate the visual control CheckBox.
Create a project called Project004.
The goal of this concept is to continue practicing what has been seen until now and incorporate the Spinner visual control. The Spinner control displays a String list and allows us to select one of them. When it is selected it opens and shows all its elements to allow one to be selected.
The ListView control, unlike the Spinner that closes after selecting an element, remains visible to several elements (used when displaying a list of similar elements).
In this first example, we will show a list of String (that is to say each element of the list is a String, we will see later that we can have lists of objects of another type: images, icons, several String by element, etc.)
We have seen the creation of objects of the Button class, now we will see another class very similar to the previous called ImageButton that has the same philosophy of handling with the difference that can show an image on its surface.
Android allows you to display a temporary pop-up window that informs the user via a message that appears on the screen for a small amount of time (after a while the window disappears).
This window that overlays the interface that is being displayed at the moment is managed by a class called Toast.
From the first problem, we have been using the control that allows in Android to enter values by keyboard. The class that manages keyboard input is EditText.
But in the component palette we see that there are many types of EditText.
It is very common for an application to have more than one window. To implement this in Android we must pose another two files one XML with the interface and another * .kt (Kotlin) with the logic (note that when we use Android Studio automatically when we create a project we create the XML file and the code in Kotlin of the first Activity)
We saw in the previous concept that a program can have more than one window representing each window with a class that inherits from AppCompatActivity.
A very common situation is that the first window needs to send data to the second so that from these proceed to perform an action.
The Android platform gives us several facilities for permanent data storage (i.e they are not deleted when the application is shut down or closed)
Depending on the type of needs we will use one of these methods:
Another possibility of storing data on our Android device is the use of a text file that will be stored in the internal storage of the computer (the other possibility is to store it on an SD Card)
In the previous concept, we saw how to create and read a text file in the internal memory of the Android team. In some situations, it might be useful to store the data on an SD card (keep in mind that not all Android devices have this feature) because of their increased capacity or the ease of sharing files with other people by delivering the SD card.
So far we’ve seen two ways of permanently storing data (text files and the SharedPreferences class), now we’ll see another native Android tool for storing data in a database called SQLite.
SQLite is an Open Source database, it is very popular with many small devices like Android.
Usually, one when developing applications on Android does all the programming, debugging and testing on a virtual device on the pc.
Now let’s see the steps to test the app on a real Android device.
The first way we will try to test our application is to copy the file with APK extension to our device.
Android organizes the visual components (Button, EditText, TextView etc.) on the screen using containers called Layout. So far we have not worried how to organize a screen, but we have focused on the functionality of each program we implement.
The Layout of type TableLayout groups components into rows and columns. A TableLayout contains a set of TableRow-like components that group visual components for each row (each row can have a different amount of visual components)
The FrameLayout type control has all the visual controls aligned to the upper left vertex, centered, right lower vertex, and so on inside the container. (it has nine possible positions).
If we have two or more controls, they are stacked.
The ScrollView along with a LinearLayout allows us to have a number of visual components that exceed the amount of space of the viewer of the phone or tablet. Then the user can move the created interface with his finger.
When we create a project to implement an application with the Android Studio development environment, it creates two default icons:
We will see the steps to play an mp3 file (other formats supported by Android are: Ogg, Wav)
Create an application that allows you to start an mp3 file, stop, continue, permanently stop and activate or not playback in a circular way. Create an mp3 file with the Audacity program counting from 1 to 30 or upload your own mp3 file.
The purpose of this concept is to access an mp3 file stored on the SD card of our computer (keep in mind that this only works with a computer that has the capacity of SD card) We must use an emulator that has configured SD card, Meanwhile, you can use your mobile device.
Now let’s see the steps to play a file stored on an internet server.
Another way to run an mp3 file is through the built-in Android player. This application plays all formats supported by Android and has an interface that will be familiar to the user of our application.
The easiest way to capture audio on Android is through the recorder provided by the Android operating system. We invoke the recording application and then recover the recorded audio.
It has the advantage that the interface is familiar to the user, since many applications use this feature.
Another way to record audio on Android is to use the MediaRecorder class. This class gives us more freedom when it comes to building an application that requires audio recording.
Graph 10000 pixels in a random white color on the device screen with black background. In order to do this simple task, we must follow a series of steps…
Paint the yellow background and draw a series of lines with different styles.
1 – We created a project called: Project034
Paint the white background and draw a series of rectangles with different styles.
Paint the white background and draw 10 circles growing from the middle of the screen.