(savedinstancestate); Setcontentview (R.layout.activity_main); //instantiation asynctask Asynctasktest test = new asynctasktest (); //start background thread test.execute (); //main thread perform task: Output Hello,world in log LOG.D ( "mainactivity" , "Hello, World" ); }}The output in the log after execution is:The first thing to do is onpreexecute, which is responsible for initializing the parameters and executing them in the UI thread, and then outputting the "Hello, World" output
not be able to respond to screen rotation. In this case, you have to correlate two directions that need to change and allow the user to switch between them until they begin to apply the main task. Start the main task, and then start responding to the device's movement. (WTF, this translation can not understand)
2.3.3 to communicate with layouts (using layout to communicate)The layout is not just a UI element in the interface, but through the layout, you can tell the user what information i
the ability to look for a string that ends with ". Scala" from a set of strings, but skips a string that begins with "-".int I=0;boolean foundit=false;while (i In Scala, you typically use the following method to implement break.1. Use a Boolean control variable.Example: Use the IF and Boolean variables below to step through the implementation using Scala (not using break and continue) as follows:var I=0var foundit=falsewhile (i 2. Use recursive functions. (Return statement is still not recommen
Clr basics (1), clr basics (
The managed code compiled by C # is managed by the Common Language Runtime (CLR). Therefore, to run C # programs, you must install the. NET Framework on your computer. To check whether the. NET Framework has been installed, check whether the mscoree. dll file exists in the system directory (C: \ Windows \ System32, if the drive C is a system disk. This file exists, indicating th
Clr basics (2): clr Basics
If you have compiled a Program. cs code file, run the following command in the Visual Studio command prompt tool:Csc.exe/out: Program.exe/t: exe/r: mscorlib. dll Program. csThis command line indicates that the csung compiler generates an executable file (/out: Program.exe) named Program.exe ). The generated file belongs to the Win32 console application type (/t [target]: exe ).A h
allows the//code to compile. However, at run time, the CLR does know//What type O refers to ( each time the cast is performed) and//it checks whether the object World抯 type is an Employee or any type//That's derived from Employee.Employee e =(Employee) o; } Public Static voidPromoteEmployee2 (Object o) {if(O isEmployee) {Employee e=(Employee) o; //Use e within the remainder of the ' if ' statement. } } Public Static voidPromoteEmployee3 (Object o) {Employee e= O asEmployee; if(E! =
Ajax BASICS (1) and ajax Basics
What Is Ajax?
Before studying ajax, let's first discuss a question-what is Web 2.0. When you hear the word Web 2.0, you should first ask "What is Web 1.0 ?" Although few people mentioned Web 1.0, it actually refers to the traditional Web with completely different request and response models. For example, click a button on the hdu.edu.cn website. Then a request is sent to the
Java basics 11 and java basics 11
Import java. util. encode; public class Eleventh {/* returns a positive integer of no more than five digits. First, calculate the number of digits. Second, print the numbers in reverse order. (5 scores) */public static void main (String [] args) {empty input = new empty (System. in); System. out. println ("enter a positive integer of no more than five digits:"); int a = in
Java basics 10 and java Basics
Import java. util. strong; public class Tenth {/* has n integers, so that the numbers in front of them are shifted to the following m positions, the last m count is the first m count */public static void main (String [] args) {variable input = new variable (System. in); System. out. println ("the number of digits you enter is:"); int a = input. nextInt (); int [] array = new
Data Structure BASICS (21), data structure basics 21DFS
Start from a vertex V0, access the vertex, and then search for the traversal graph from each unaccessed adjacent vertex of V0 in sequence, until all vertices having the same path with V0 in the figure are accessed (using the stack ).
// The depth of the undirected Graph stored using the adjacent matrix preferentially traverses the template
BFS
Sta
Data Structure BASICS (18) and data structure basics 18Hash table
Based on the set hash function H (key) and the selected method for handling conflicts, a set of keywords are mapped to a finite continuous address set (interval, the keyword "image" in the address set is used as the storage location of the corresponding record in the table. In this way, the searched table constructed is called a "hash table "
Data Structure BASICS (16) and data structure basics 16Basic Terms of the tree
1. node: {Data Element + several branches pointing to the subtree}
2. node degree: number of branches (number of sub-trees)
3. Tree degree: the maximum degree of all nodes in the tree
4. leaf node: zero degree Node
5. branch nodes: nodes with a degree greater than zero (including the root and intermediate nodes)
6. (from the root
Data Structure BASICS (17), data structure basics 17
Features of binary sorting tree
The binary sorting tree is either an empty tree or a binary tree with the following features:
1. Each element has a key value, which cannot be repeated;
2. If its left subtree is not empty, the values of all nodes on the left subtree are smaller than the values of the root node;
3. If its right subtree is not empty, the val
Data Structure BASICS (19) and data structure basics 19Double Rotation
A single rotation problem sometimes occurs (as shown in ):
(If the child node [k1] on the inner side is too deep, moving it one way will not solve the problem)
So there is a double rotation.
Double rotation to the right:
1. First, take k1 as the axis, and k1 and k2 rotate to the left;
2. Take k3 as the axis, and k3 and k1 after rotat
Data Structure BASICS (18) and data structure basics 18
The red/black tree is a self-balancing binary search tree and a data structure used in computer science, A typical purpose is to associate arrays (map/set in C ++ STL ). It was invented by Rudolf Bayer in 1972. It is called the symmetric Binary Tree B. Its modern name is Leo J. guibas and Robert Sedgewick obtained in a paper written in 1978. Although t
Data Structure BASICS (15) and data structure basics 15
Base sorting is an internal sorting algorithm that uses the "Multi-Keyword sorting" idea to implement "Single-Keyword sorting.
There are two methods to sort multiple keywords:
Ranking priority (LSD)
First, sort K [0] {the smallest digit} of the base, and divide the record sequence into several subsequences based on different values of K (0, sort K [1 ,
Java Memory Model basics and java model Basics
Java Memory Model: 1Thread communication: 2Re-sorting: Program EfficiencyHappens-before: If yes, it will not be reordered.Memory barrier command: deprecated sortingData Dependency: a single thread exists and will not be rearranged.As-if-serial: ensures that the rescheduling has no effect on the results of a single thread.Data competition: Correct synchronizat
Python basics 6: formatting characters, colors, and python Basics
Character formatting:
1.% placeholder, % s, % d, %
2. Use format. The format is easy to use. It can be centered, %, binary, and character-filling;
1. Use Case of %
Tp1 = "I am % s" % "aaa "#Tp2 = "I am % s age % d" % ("alex", 18) # sequential AssociationTp3 = "I am % (name) s age % (age) d" % {"name": "alex", "age": 18} # specify the name a
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.