Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Chapter 17 The next step is to learn direction


May 21, 2021 Android SDK Getting started


Table of contents


Chapter 17 The next step is to learn direction

Through previous articles, we learned about various development tools, explored the basic elements contained in application projects, learned user interface design, interactivity, resources, and how data is used, and we thoroughly tracked the entire process of running the application. S o far, we've covered enough knowledge to help you start android application development from an ideal starting point, but Android offers much more room to play, so the possibilities in development are almost exhausted. T herefore, we need to choose a clear direction for our next step in learning. I n today's article, we'll focus all our attention on the future learning objects that can be selected. In the next article in this series of tutorials, the last article, we'll review what we've learned in a quiz.

By reading this tutorial series, you should already have a variety of potential development directions to choose from when creating an Android app. O f course, if you have planned a specific development project, then the actual needs from this is enough to guide you to clear the future learning path. B ut the Android platform offers a wealth of elements, and many of them are universally applicable to most of the apps we're going to touch. In today's article, we'll take a closer look at some of the most practical topics and use this as a starting point to build a complete system of Android development skills.

Data

The first step

You can try the various Android development techniques described below using the sample application project we created earlier. P lease note that we originally kept the data in the shared preferences, so you can choose to save the data in the file. W hat we're trying to do is try to get users to commit and save data using the AccessText view and feature buttons. W rite user data to a file, let the application read its contents at startup, and display the results in TextView view. In this way, you can save persistent data from the next time the application runs.

Step two

Another important skill is getting data from remote resources, such as Web services. T o achieve this, we need to add an internal AsyncTask class to theActivity class and use it for remote data acquisition. A fter you get the data, you also need to display it in your application. I n addition, if your application gets XML, JSON, or some other common data format, you may want to parse it or format it. See Google's official "Connect to the Web" section, which provides sample code that is sufficient as an ideal starting material.

Step three

Another major data storage option is also applicable to the actual requirements of many applications, which is to use the SQL database. Y ou can try this by creating an SQLiteOpenHelper class, where we need to define the chopping schema, such as tables and columns. I n other parts of the application, we can ask the SQLiteOpenHelper class to write data to the database and use cursors to implement content reading, so that the results are displayed in the application's user interface. A gain, we may need to save the user-entered data in the database and display the results the next time the application starts. I n addition to inserting records into the database and querying them, you can try to update and delete records. As a starting point for our first start, let's start by reading Google's official "Save data in the SQLite database" description.

2. Apply the screen

The first step

Of the applications that have been created, we have used only one action screen in the user interface. N ext, you can increase the number of screens by creating a second activity class in your app, which is to open the File, New, Class menu options sequentially. T oday's task is to add a button to the first screen, which is the main activity, and to activate the second activated when the user touches the button. F or example, if we're developing a game app, the text displayed by the button can be "game description" and the name of the second activity can be set to Howe .java. C reate a layout file for the second activity that contains a TextView that saves the text content in the res/values string XML file. I f the sample application we're using is a game as described above, then the second activity should contain information about how and how the game works. A large portion of the information display in the application can be handled in this simple way.

In the first activeity onClick handler, you can start the "game description" activity using intents. O nce we include a second activity in our application, we need to submit data from the first activity to it using the putExtra method. Y ou can also try, in turn, to have the second activity perform certain tasks and provide the results to the first activity. T he latter needs to receive the result data through the onActivityResult method. Please click here to view Google's official "Activity Class References" instructions to learn more about this.

Step two

As the next step, you can try to include multiple different user interface views in your own activity. I t will also be noted that different types of views need to be implemented in different ways. Now that you've mastered how to use different view types, let's try fragment -- so that we can reuse the components of the user interface in different parts of the application.

Another highly practical user interface component is the list view. I n list view, the screen displays a list of multiple entries. T he system uses adapter to populate the list view with information from the data source, that is, to implement a data-to-view mapping. Y ou can use ListActivity instead of the standard Actity class. I n list activity, you can rewrite the method set in response to the user's interaction with entries in the list. As a starting point for learning list views, you can start by reading the examples of list views features officially available from Google.

In general, applications are best kept in the same appearance and experience as the Android system itself. W henever possible, you should try to make use of standardized Android user interface elements instead of creating your own custom components. For this reason, you may want to learn more about Action Bar and always remind yourself to follow these conclusions when designing the user interface and the navigation patterns of your application.

Multimedia

You can use a variety of media types in the Android app you create, such as audio and video, animation, and even video captured by your device's camera. A ndroid provides a range of standard methods that allow you to access device resources, such as cameras, and implement specific usage needs, such as video recording. Check out the "Multimedia Guide" section of the Android Developer's Guide for more information.

As we mentioned in this series of tutorials, you can use XML in your Android application to create visual elements and get your own drawable components. Y ou can also use XML to define animations and control how they play through code. O n the Android platform, we can use animations to add a variety of dynamic effects to the user interface - the system supports a wide range of effects, including fade-in, rotation, flip,and various other transition types. Click here to see Google's official "Add Animation" description.

4. Interact with other applications

The first step

One of the advantages of developing applications on the Android platform is that we can leverage the resources available on the platform, including other applications. A s I mentioned in the previous articles in this series of tutorials, you can share data between different applications and use it in your own apps. Y ou can also allow users to share content in our apps using email, instant messaging, and social networking. T he easiest and most reliable way to share data is to take advantage of end intent. W hen our application launches a send activity, the operating system provides the user with a list of programs to use, which lists which destinations the user can send the content to. Please read Google's official "Send Simple Data to Other Apps" instructions, which also include a few examples, before you try.

Step two

In addition to using send, there are a number of other ways we can enable Android resources from within the application, so please try more on your own projects. F or example, a large family can use dial-out phone numbers, view meetings in a browser, or use location information in a map app. Y ou can also get data from the device's built-in sensors, enabling your application to capture and process data related to location and surrounding environment. I n most cases, we can trigger other actions by establishing a relationship between the application and the Android environment at the end of the action launch and returning information to the application. In this way, our applications can take advantage of the mobile features offered by Android devices.

Resources

The first step

We've discussed some of the main potential directions for future learning, but the reality is that we're still exposed to only a fairly superficial layer of knowledge about the Android platform. T he platform is still changing, and the list of feasibility is getting longer and longer. Recommended technologies for common tasks are also subject to change, so if you want to keep developing high-quality Android apps, remember that continuous learning is the most important professional habit.

Let me recommend some useful learning resources for you:

Visit the Android Developer Blog for the latest and future trends on the platform. The blog also often provides functional code samples that can be used as good learning material.

The Vogella Android Guide is one of the most android learning resources available on the web. The Vogella website typically provides a complete technical sample project that details the expertise involved in the official developer guide.

The Android Developer Communication Platform on Google Plus often posts a lot of announcements to discuss topics with Android development, which also deserves more attention.

As with other development platforms, you'll find more errthroid issues as you learn about Android, most of which need to be addressed through web search. As you all know, many frequently asked questions can be answered on Stack Overflow - if you're not a regular visitor to the site, check out it right away.

Conclusion

In this series of tutorials, my goal is to help you learn the basics of Android development. I f you've ever learned programming or development skills in the past, it's clear that this series of tutorials is far from the end of the journey. I f you're interested in continuing to develop apps for the Android platform, you need to be proficient in using the knowledge described in this tutorial and keeping it a good deal of the wealth in the Android toolbox. At the end of this tutorial series, I'll provide a test in the next article to see if you really have a grasp of what was mentioned earlier - get ready!