Enjoy the Java technology Feast for Android apps

Source: Internet
Author: User
Tags requires thread

Ready to start

This article describes several of the Android SDK tools that handle complex situations. Developing Android apps requires the latest version of the Android SDK, which requires a Java Development Kit (JDK). I am using the Android 2.2 and JDK 1.6.0_17. Physical devices are not required; All the code in this article works well on the Android emulator that comes with the SDK. This article assumes that you are familiar with Android programming and do not involve Android Foundation development, but it is also possible if you have knowledge of the Java programming language.

Concurrency and networking

Common abbreviations

API: Application Programming Interface

SQL: Structured Query Language

SDK: Software Development Kit

UI: User Interface

XML: Extensible Markup Language

One of the most common tasks of an Android application is to retrieve data or send data over a network to a remote server. The result of this operation is usually some new data that you want to show to the user. This means that you need to modify the user interface. Most developers know that you will not perform a potentially long-running task, such as accessing data over the network on the main UI thread (especially with a very slow phone with a network connection). Freeze your application until the long-running task completes. In fact, if the task exceeds 5 seconds, the Android operating system will have the infamous application not responding dialog box, as shown in Figure 1.

Figure 1. Android Infamous application not responding dialog box

You cannot know how slow a user's network connection can be. To avoid risk-taking, you must perform a task on a different thread, or at least not on the main UI thread. Many Android applications, but not all, need to handle multiple threads, which causes concurrency. The Android database is a good choice for applications that often need to save data locally. These three scenarios (different threads, concurrent and locally saved data) have many standard methods to process in the Java environment. However, as you will see, Android offers a different choice. Let's look at it one by one to see its pros and cons.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.