Android Knowledge Points Collection (continuous update)

Source: Internet
Author: User

Res/raw and asserts

The same point: the package will remain intact in the apk and will not be compiled into binary.

Differences: Files in Res/raw will be mapped to R.java, asserts will not be able to read the directory structure under Res/raw, asserts can.

READ: Res/raw using InputStream input = Getresources (). Openrawresource (int resId);

Asserts uses InputStream input = Getasserts (). Open (String fileName);

Getwritabledatabase () and Getreadabledatabase ()

Both can obtain a sqlitedatabase instance that is used to manipulate the database.

Getwritabledatabase () Opens the database in read-write mode, and when the database disk space is full, the failure is turned on.

Getreadabledatabase () executes Getwritabledatabase () first, and when open fails it continues to attempt to open the database as read-only.

Code Mode setting Activity

No title bar: Call Requestwindowfeature (Window.feature_no_title) before Setcontentview ();

Custom title bar: Requestwindowfeature (window.feature_custom_title);

GetWindow (). Setfeatureint (Window.feature_custom_title, R.layout.title_bar custom title bar layout);

Fullscreen: GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, previous parameter);

ANR (Application not Responding) program is unresponsive

By default, the maximum execution time for an activity is 5 seconds, and the broadcastreceiver maximum execution time is 10 seconds.

Avoidance scenario: The main thread does as little as possible. Potentially time-consuming operations, such as network or database operations, or high-time calculations such as changing the bitmap size, should be done in a child thread.

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.