Multithreading case -- Timer
In this case, the interface is displayed after the screen is started.
There is a text box on the screen to show the elapsed time, and there is also a "stop timing" button. Use case diagram.
A single-threaded program
Some netizens will find that the Activity is switched to the background or the layout is switched from LANDSCAPE screen LANDSCAPE to PORTRAIT. Switching the Activity again will trigger an onCreate method. We can go to androidmanifest. add the
The communication mechanism of the Binder is simple, but some problems have been encountered in the use process. Finally, we have solved the problem. Here we will summarize the problems and share them with you:
1. To use Binder for communication,
I learned a lot about how to exit Android Activity online. I tried a variety of methods. The following method is my favorite, simple and easy to understand.
Create an Activity management object in singleton mode. The object contains an Activity
I recently had a local area network socket connection problem. To share a socket connection between multiple activities, I searched the internet for information. I still feel that the application method is easy to use. I will post it and share it
Due to the needs of a project, I studied the network communication mode of android, which is similar to that of the java platform!
The android platform also provides a lot of APIS for developers to use. Please refer to the figure below:
First, we
Custom dialog is certainly a lot of use, but it feels like every execution is messy and simple to complete the task. Now, after encapsulating it, you can use direct copy.
First:
Main activity
Copy codeThe Code is as follows: package com. su.
This issue is explained in a specific section in the Android development documentation. In simple terms, Activity is the most important mechanism for interaction with users. Any Configuration changes may affect the Activity interface, at this time,
1. Set the font color directly in the configuration xml file under the layout file, and change the color by adding android: textcolor = "# FFFFFF"
However, this effect only allows the font to display one color.
2. in the activity, use TextView
Private long exitTime = 0;/*** capture return event button ** because this Activity inherits TabActivity and does not respond with onKeyDown, so you can use dispatchKeyEvent * for a general Activity to use onKeyDown */@ Overridepublic boolean
The dual-buffer technology means that after the user operation interface is complete, a buffer zone will be provided to save the user operation results.
Why is dual-buffer technology used? For Android game development, the UI is all re-painted every
Android or laterOverridePendingTransition (R. anim. translate_in, R. anim. translate_out) can be used to switch the animation.But the trouble is that you must finish the previous one when switching the animation.And you cannot control the animation
TextView in Android supports some Html format tags. This includes common font size and color settings and text links. It is easy to use. You only need to use Html class conversion. For example:TextView. setText (Html. fromHtml (str ));I. Implement
In Android, graphic interfaces and multimedia operations are easy to implement. In addition, most mobile phone users modify the system based on these features. We can use the source code of the Android multimedia framework introduced in this article
I. Basic Knowledge:
SurfaceView is inherited from the View. The View is responsible for updating the animation in the main thread, while the SurfaceView is used to update the animation in a new thread.
Main Methods of SurfaceView class:
// Called
Question about the size of the write function in AudioTrack
When I recently read the Audio-related section in "an in-depth understanding of Android" and saw the implementation of the AudioTrack: write function, I have some questions about the
1. The main UI thread cannot be updated in the Child thread. It must be updated using the Handler, AsyncTask, or View postDelay () method.
2. The Toast cannot be displayed in the Child thread. (This is similar to the first point)
3. If an activity
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