Bootanimation.zip trap
In android, bootanimation.zip is often used to create boot animations. All the tutorials on the Internet are described in the previous sections. I encountered a strange problem during the test, that is, I could not display the boot animation, it was a black screen, and after entering the system, only half of the screen can be displayed, black screen on the left.
At first, I thought it was a problem with the PNG image format. I
more than putting the queried cursor into a group member variable of the activity class. When the activity stops, it will turn off every cursor in the array, and in resume, each cursor in the array is queried again. So after you press the Home key, the activity is stopped and the cursor is closed. If a thread continues to use this cursor, an exception is thrown.
Therefore, when using managedquery (), you need to know when the cursor will be released, and consider that your code will no longer n
occurred. Managedquery () is actually nothing more than putting the queried cursor into a group member variable of the activity class. When the activity stops, it will turn off every cursor in the array, and in resume, each cursor in the array is queried again. So after you press the Home key, the activity is stopped and the cursor is closed. If a thread continues to use this cursor, an exception is thrown.
Therefore, when using managedquery (), you need to know when the cursor will be released
1. First list the codeBase.javapublic class base{ Base () { preprocess (); } void Preprocess () {}}Derived.javapublic class Derived extends base{public String whenamiset = "set when declared"; @Override void Preprocess () { Whenamiset = "set in Preprocess ()";} }Main.javapublic class main{public static void Main (string[] args) { Derived d = new Derived (); System.out.println (D.whenamiset); }}2. Implementation results3. ReasonThe http:
variable that the int *const p2;p1 points to is immutable, and the P2 pointer itself is immutable. After code validation we found that either the const PINT P1, or the PINT const p2; The effects are equivalent to int *const, p1 and P2 are immutable. What if we want the variable that the pointer points to to be immutable?typedef const INT* Cpint;Cpint P1,cpint P2; This way the P1 and P2 themselves are mutable, and the variables pointed to are immutable. 1231235.typedef and Function pointers
for(i=0;i) {3 if(SearchString = = Array[i])return true;4 }5 return false;6 }7 if(In_array (' oak ', Trees)) document.write (' true ');//Display True8 Elsedocument.write (' false ');2. The proper use of the native JS method in the operator:(since we know that in can be used to determine the property value of an object, we can also map array one by one to the object's properties, and then use in to judge.) )1 functionOC (a)2 {3 varo = {};//equivalent to var o = new Object ();4 f
mode. The activity of this mode is only opened in a separate task stack, and there is only one instance of this new task stack. When the activity instance is started again, the existing tasks and instances are reused (and called onnewintent). Other activity initiated by the activity is automatically run with another task stack.
The difference between singleinstance and Singletask:
SingleInstance at the same time, there will only be one instance in the system, while the activity of
");LocalBroadcastManager.getInstance(context).sendBroadcast(intent);Log as follows:12-09 17:20:47.799 15019-15019/cn.codingblock.androidadvancestudy I/MyBroadcastReceiver: 接收到广播消息:我是一个本地广播12-09 17:20:47.799 15019-15019/cn.codingblock.androidadvancestudy I/MyBroadcast2Receiver: 接收到广播消息:我是一个本地广播Iv. Sticky Broadcast (not recommended)Sticky broadcast will remain in a state of detention, sticky broadcast is issued, as long as there is able to match its new receiver is registered to receive the broadc
Java.Util.Arrays can convert an array to a list, specifically defined as follows:@SafeVarargspublic static You can see that the array is actually converted into a arraylistEnter arrays source code only to discover ... This deceptive ...
1. List
2. Abstractlist
3. Arrays.aslist after the list
The arraylistprivate static class ArraylistDefinition of Abstractlist:Public abstract class AbstractlistThen look at the implementation of the Add and
definition: Used to allocate memory space for a variable, and you can also specify an initial value for the variable. In a program, variables have only one definitionDeclaration of a variable: used to indicate to the program the type and name of the variable. A definition is also a declaration: When defining a variable, we define its type and name. We can use the extern keyword to indicate that it is in the declaration and not in the definition.Such as:extern int A;//declaration int A;//definit
is use name = Get_name - //because name would get get_name address it s in the stack + //It's stupid idea. A returnname; at}Consider the memory problem remember to delete after new, freeing up memory resources.delete [] name;did not learn C language, according to the document with Malloc-free version.1#include 2#include 3#include 4 using namespacestd;5 Char* GetName (void);6 intMain ()7 {8 Char*name;9Name =getname ();Tencout "My name is:"Endl; One //Delete [] name; A Free(n
characters of their respective times. So now we know the answer, the output is as follows:FalsetrueNext, let's look at the following code:Class person{public String name; Public person (String name) { this.name = name; } Public String GetName () { return this.name; }}Now if the 2 person objects are compared, if the name is the same, then the same person is judged, how do you do it? First analysis: To determine whether the same person, this object is inherited from t
arguments, and in the constructor, age, and hight2 variables are variables that are not class Person01. So the operation here is to change the value of the variable within the constructor method, without affecting the class variable, so the result is conceivable. Can you imagine what the result would be if you used the This keyword? The result is also: age:10;hight:0The above example just says static functions and static fields, and now let's see if there are constructs and static code libra
The Hidden Trap of AsynctaskLet's take a look at an example
This example is very simple, it shows the extreme use of asynctask, very strange.
Copy Code code as follows:
public class Asynctasktrapactivity extends activity {
Private Simpleasynctask Asynctask;
Private Looper Mylooper;
Private TextView status;
@Override
public void OnCreate (Bundle icicle) {
Super.oncreate (Icicle);
Asynctask = null;
New Thread (New Runnable () {
@O
Copy Code code as follows:
var a = parseint ("a"), B = Number ("09");
A lot of people think that A and B are numbers 9, but they're not.
The main function of parseint is to convert a string to an integer, or to convert a decimal number to an integer. In general, we use only its first argument. But in fact, it has two parameters:
parseint (string, radix)
The parseint will be converted according to the radix specified, for example:
Copy Code code as follows:
Aler
Tags: sp strong on BS nbsp SQL user UI AppProject temporarily added a feature, at this time we are accustomed to splicing a SQL.More frightening is, the late user request new query conditions, even have 10 query conditions, then the stitching more headache, if appendAppend ("[email protected]")Append ("and ...")Turns out to be @statusand.There is a clear error when executing SQL, and there is no @statusand variable.Enlightenment:The best way is to avoid stitching SQL;or override the Stringbuild.
Label:1. Using parameter
// using constructors, it is not recommended to write this way Parameter p = @id " // Parameter p =new Parameter () {parametername = @id , Value=" " };cmd. Parameters.Add (p);
Recommended and not recommended for what? In the following.
2. Using the parameter array
//non-recommended wordingparameter[] PMS =Newparameter[]; { NewParameter ("@id", value); ......}; Cmd. Parameter.addrange (PMS); //recommended WordingSqlparameter[] Pms= {
In general, logical operations Ab and a| | B is the logic and operation and the logic or operation, the return is a Boolean value, either True or false. For example, in PHP, the ab return type is always a Boolean value, not true or false. and JavaScript in the | | is a trap, JS inside the and | | A little out of the ordinary way. Summary js | | Rule: The following A and B can be a value, a variable, an expression, respectively.
JS for the
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.