Android with notes

Source: Internet
Author: User



1 Activity life cycle

2 Inherit the application class, where the attribute is used as a global variable whose life cycle is similar to application in the Web, and will remain in memory unless the application is shut down and destroyed

3 Static Final http://www.2cto.com/kf/201109/104884.html
4 The differences between gravity and layout_gravity are aligned for view and container, respectively, in the way that the contents of the component are relative to the external container.

Kjlibrary defaults to caching data for all HTTP traffic, with a cache time of 5 minutes. This is done not only to save the user's mobile phone traffic, but also to reduce the server pressure

Shrinkable The column can be shrunk strechable the column can be stretched


5 Framlayout Advanced Post-out also known as stack layout


6 Tablelayout Three properties collapsed the column is hidden

is an ORM and IOC framework for Android. It also encapsulates the framework of bitmap and HTTP operations in Android, making it easier to use;
7 Picture Carousel Component Android-image-indicator

Http://git.oschina.net/kymjs/KJFrameForAndroid

8. Kjframeforandroid is a framework to help develop quickly. With Kjframeforandroid, you can complete HTTP requests, network picture loading, database data saving, or reading with just one line of code.

http://git.oschina.net/

Binding service life cycle: OnCreate ()->onbind ()->service bind---->onunbind ()->ondestory->service shut down

Bitmaplibrary is the first to use soft references to cache pictures, After android2.3, Google proposed that garbage collection would be more inclined to reclaim soft references or weakly referenced objects, so soft references and weak references become less reliable, and after 3.0 the picture cache is placed in memory, but there is no foreseeable way to release it, bitmaplibrary using the LRU algorithm that column cache memory Storage and disk caching to manage cache calls more efficiently


The Httplibrary module uses the httpclient and httpurlconnection two implementations to realize network communication, data upload, multi-threaded breakpoint download. According to Google advice: before the 2.3 system due to httpurlconnection instability and a certain bug, should try to use httpclient, after 2.3 of the system, if only simple data interaction, you should use a more lightweight, Easy-to-expand httpurlconnection. For the implementation of the way, Kjlibrary will be referred to the developer to choose.


9http://www.oschina.net/p/gifview gif picture Display

Dblibrary contains an ORM framework in Android, and a single line of code can be used for additional pruning. Support one-to-many, many-to-one queries.
The DB module, which is largely referenced by the FINALDB design, is based on the completion of almost all API annotations, with more customizable DB operations
10.Notifications has standard notifications and large notifications and custom notifications Notification.builder objects to set the properties of the notification subject, content, ringtone, and so on, Notificationcompat is a large notification object The intent is to use pendingintent, which is an unpredictable trigger intent Notificationmanager object Call notify (int Id,builder.builder ()) object to turn on notification

First the service is not a thread and they have nothing to do with it, but the service typically handles time-consuming tasks with a wired thread. Then ask the activity why not use the service directly with the thread? The answer is that the service is not dependent on activity, and other activity can communicate with the service, but specifies that the internal thread specified by the activity cannot be accessed by other activity

Service Lifecycle (normal service life cycle and binding services lifecycle)

When sticky service and non-sticky service memory are low
The int type returned in the Onstartcommand method is sevice.start_not_sticky non-sticky (not created) service.start_sticky sticky (will be created but not transmitted intent) Service.start_ Redeliver_intent (will create intent will also be passed)
11. Service and Thread differences

Notifies the progress bar that the notification of the specified ID is cycled through a thread using builder.setprocess notify

Service interacts via notification

Remoteviews setting up a custom notification

If you need to interact with the main thread when you should use handler such a thread, do not need to interact with the service

The difference between service and Intentservice: Intentservice has its own thread and does not need to handle Onstartcommand and OnStop service like a service, Only need to handle onhandlerintent there is a looper queue to ensure that intent runs in a separate thread without blocking state, and can handle time-consuming operations directly in Onhandlerintent

Normal service life cycle: Oncreate->onstartcommand ()->servicerunning->ondestory ()->service shut down






Android with notes

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.