Project: Creating a Weather App for Android using a third-party REST API
For this project, we'll create a real-world android app: a Weather App. During the development of this project, you will learn some fundamentals of Android, how it works with a third party REST API, and more.
Make an Android app with a simple and clean use of a third-party REST API to display weather information on Android UI.
Work with JSON and JSON Object in Android.
Use HttpURLConnection class to open a connection to the third-party API.
In this lesson, you'll use the Android Studio Layout Editor to create a layout that includes a text box and a button. In the next lesson, you'll make the app respond to the button tap by sending the content of the text box to another activity.
Figure 1. Screenshot of the final layout
The user interface for an Android app is built using...
After completing the previous tutorial, you have an app that shows an activity (a single screen) with a text field and a button. In this tutorial, you’ll add some code to MainActivity that starts a new activity to display the message when the user taps Send.
Note: This lesson expects that you are using Android Studio 3.0 or higher.
Respond to the send button
Add a method to the MainActivity class that's called by the button as follows:
In the file app > java > com.example.myfirstapp > MainActivity, add the sendMessage() method stub as shown below:
Android apps can be written using Kotlin, Java, and C++ languages. The Android SDK tools compile your code along with any data and resource files into an APK, an Android package, which is an archive file with an .apk suffix. One APK file contains all the contents of an Android app and is the file that Android-powered devices use to install the app.
Each Android app lives in its own security sandbox, protected by the following Android security features:
The Android operating system is a multi-user Linux system in which each app is a different user.
By default, the system assigns each app a unique Linux user ID (the ID is used only by the system and is unknown to the app). The system sets permissions for all the files in an app so that only the user ID assigned to that app can access them.
Each process has its own virtual machine (VM), so an app's code runs in isolation from other apps.
In this tutorial, you’ll learn how to create a "Hello World" project with Android Studio and run it. Then, you'll create a new interface for the app that takes some user input and opens a second screen in the app.
But before you start, there are two fundamental concepts you should understand about Android apps:
1) Apps provide multiple entry points
Android apps are built as a combination of components that can be invoked individually. For example, an activity is a type of app component that provides a user interface.
The "main" activity is what starts when the user taps your app icon, but you can take the user straight into a different activity from other places, such as from a notification or even from a different app.
Other components such as broadcast receivers and ser...
Swift provides three primary collection types, known as arrays, sets, and dictionaries, for storing collections of values. Arrays are ordered collections of values. Sets are unordered collections of unique values. Dictionaries are unordered collections of key-value associations.
Arrays, sets, and dictionaries in Swift are always c...