Android Knowledge Pack 1

Source: Internet
Author: User

1.android principle
Menu-->mainactivity-->oncreate-->setcontentview (r.layout.item)-->layout (item.xml)-Interface (output)
Sysout ();-->logcat (Reference)-->adb Logcat (AVD on)-->chcp 65001 (dos not cached)

2. Call
Intent (Transfer object of data)
Intent in = new Intent ();//intent.action_call
In.setclass ();
StartActivity ();

3. Common Controls: (MyEclipse drag GUI control)
TextView EditText Button ImageView SeekBar ProgressBar tooglebar ListView Spinner

Monitoring event Spinner (onitemselected)

Class listener, Method Listener, anonymous inner class, android:onclick= "test"

4.mp3
/mnt/sdcard-/sdcard (Hard connect: shortcut)
Common Linux Commands:
LS (list) view
CD (change directory) changes the catalog CD.
PWD (Print workspace directory) View your location
mkdir (Create folder)
Touch (Create File)
Rf-f (forcibly delete any files and directories)
CP (copy) copy
MV (move) cut
TAR-CZVF/-XZVF (Create/Unzip compressed files)
Mount/umount (Mount and unload)
RPM (*.rpm file)

5. Are there several ways to turn on multithreading?
①thread②runnable③ thread pool Fullabe, Service

public class Test1 extends Threads {

public void Run ()/** throws IOException */{//run () method cannot throw an exception
}
public static void Main (Stirng args[]) {
New Test1 (). Start ();
New Test1 (). Start ();

Test1 tt = new Test1 ();
Tt.start (); Multithreading
Tt.start (); Cannot open two
Tt.run (); Single thread here can
}

}
Deadlock (Synchronous code block)
Sleep ()/isinterrupted
Wait () must be in conjunction with the synchronization Code/notify () or Notifyall ()


5.QQ Chat
1.ServerSocket Socket (TCP communication)
2.IO Stream
3.GUI
If an exception occurs, be sure to put it in the final treatment. (Exception does not affect program process)

Difference:
1, 10.0.2.2 (AVD fake machine)/IP (Ipconfig/ifconfig (Startup/setup))
2. If Android version is greater than or equal to 4.x you must turn on sub-thread connection background
3. Set permissions
4. The UI control cannot be manipulated directly in the sub-thread, but only through the handle mechanism can the main thread be returned.

6. Broadcasting mechanisms
In the program registration, menu registration, system broadcast and other three gradually use more.

Life cycle of 7.Activity
OnCreate OnStart onrestart onresume OnStop ondestory OnPause

The second week the main content:
Layout, message (Notification), breakpoint download, communication, WebService

Layout:
Linear layout, table layout, relative layout, absolute layout, frame layout

Layout management:
<LinearLayout>
...
</LinearLayout>

<!--default is level, robbery color software,-->
<!--android:orientation: If you have 2 or more than 2 controls in a linear layout, you must use the
Layout_weight weights and fill_parent are inversely proportional to wrap_content.
Android:gravity represents the position of the current text in the control where the current text is located
Android:layout_gravity: The position of the control where the current text is located in the layout of the fish that the whole control eats.
-

Android Knowledge Pack 1

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.