• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/23

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

23 Cards in this Set

  • Front
  • Back
Responsiveness
1.Application responsiveness is important for mobile applications
2. Don’t tie up the UI thread with long-running blocking calls such as network requests or slow local operations (such as unzipping a file).
3. Startup process should not contain long-running tasks
Responsiveness
4.Create asynchronous tasks to perform background operations using threads.
5.Network operations can involve unpredictable delays. To prevent this from causing a poor user experience network operations are normally performed on a separate thread from the UI.
6. Use a progress bar for feedback to the user.
7.Background tasks need a way to communicate back to the main thread to indicate progress or when they have completed
Android main thread?
1.When you call setText() on a TextView the UI is not updated immediately.
2.message is put on the message queue telling the OS to update the screen.
3.The queue is processed by the main application thread, the UI thread
Android main thread?
4.As long as the UI thread can keep processing messages the screen will be updated
5.But it also processes all callbacks such as onCreate() and onClick() etc.
6.While it is executing these methods no messages are processed on the queue
Android Main tread
-The UI freezes because the application is continuously trying to display the value of the counter while at the same time it is pausing for one second after it has been displayed.
-The UI can’t process the message queue because it is sleeping.
-The result is a nonresponsive application that will frustrate your users.
Android Main tread
-To solve this problem, using a Thread class implementing Runnable the interface.
- a Runnable as a block of code that can be executed by a thread.
-You first create a class that implements the Runnable interface.
-Within this class, you put your long-running code within the run() method.
-The Runnable block is then started using the Thread class start() method.
Android Main tread
-Solution is to let any thread post messages onto the queue but only the UI thread can read messages off the queue.
-You need to use the post() method of a View to create another Runnable block to be added to the message queue.
-The new Runnable block will then be executed by the UI thread
Async tasc
-Better option is to use a utility class called AsyncTask.
-The goal of AsyncTask is to take care of thread management for you.
 -AsyncTask must be used by subclassing it.
It is also very important to remember that an AsyncTask instance has to be created on the UI thread and can be executed only once.
Android threading
-Android Activities can be in different states depending on the behaviour of the user and the needs of the OS.
-Activities are created, moved in and out of the background, and destroyed as necessary.
-Activities can’t do any actual processing while in the background
Services
-background processes in Android are typically handled via application components known as Services, which are UI-less classes that can run independent of the Activity lifecycle
-The lifecycle of a Service is governed by how it’s started and who is connected to it.
-Services are referred to either as a Started Service or a Bound Service
Sarted Service
explicitly started by either an object in the same application, or is started at device boot (if the Service is configured to do so). Generally, a Started Service will run until explicitly stopped by the caller, the OS, or from inside the Service itself.
Bound Service
-provides a direct link to a particular Service and its members within an application.
-Typically started when a client within the same application (usually an Activity), binds to that Service, which causes Android to start the Service.
-Android will keep Bound Services running as long as clients are connected or bound to it. When all clients disconnect, or unbind, Android will stop that Service
**Hybrid Service:**
(very powerful and common way to use Services)
Lifecycles of both Bound and Started Services can be combined by explicitly starting a Service and then binding to it. This offers the advantage of starting a Service independently of the rest of the application, providing it with an opportunity to do work, and then to also be able to connect to it directly when it needs to access it
Async tasks vs. Services.
-AsyncTasks are designed for once-off time-consuming tasks that cannot be run off the UI thread
-Services are designed to be continually running in the background
iOS threading
-The iOS application lifecycle is a collection of application states and methods for moving between them.
-An application transitions between states based on the behaviour of the user and the backgrounding requirements of the application.
Ios app life cycly
1. Not Running
2. Running/Active
3. Inactive
4. Back grounded
5. Suspended
6. Return to Not Running/Termination (Rare)
Not Running
The application has not yet been launched on the device.
Running/Active
The application is on the screen, and is executing code in the foreground.
Inactive
The application is interrupted by an incoming phone call, text, or other interruption.
Backgrounded
The application moves into the background and continues executing background code.
Suspended
If the application does not have any code to run in the background, or if all code has completed, the app will be Suspended by the OS. A suspended application's process is kept alive, but the application is unable to execute any code in this state.
Return to Not Running/Termination (Rare)
Occasionally, the application's process is destroyed, and the application returns to the Not Running state. This happens in low-memory situations, or if the user manually terminates the application
iOS app lifecycle
-Since the introduction of multitasking support, iOS rarely terminates idle applications, and instead keeps their processes Suspended in memory.
-Keeping an application's process alive ensures that the application launches quickly the next time the user opens it.
-It also means applications can move freely from the Suspended state back into the Backgrounded state without drawing on system resources