"Android Development Art Exploration" reading notes (iv)--remoteviews

Source: Internet
Author: User

NO1:

remoteviews Usage scenarios: Notification bar and desktop widgets

No2:

The notification bar is mainly implemented by Notificationmanager 's Notify method.

Desktop Widgets are implemented through Appwidgetprovider , and Appwidgetprovider is essentially a broadcast

No3:

Implementation of the notification can see my other notification notice

The implementation of the Desktop widget can be seen in my other desktop widget development

No4:

Pendingintent 's understanding can be seen in my other article pendingintent

NO5:

The types supported by Remoteviews are as follows:

Layout: Framelayout, LinearLayout, Relativelayout, GridLayout

View: AnalogClock, Button, chronometer, ImageButton, ImageView, ProgressBar, TextView, Viewflipper, ListView, GridView, StackView, Adapterviewflipper, viewstub

Remoteviews does not support their subclasses and other view types , and therefore does not support custom view

NO6:

A series of set methods for Remoteviews is done by reflection .

No7:

Layout files in the notification bar and desktop widgets are actually loaded in notificationmanagerservice and Appwidgetservice , and they run on the system's Systemserver , this is a scenario in which our process forms a cross-process communication

No8:

The role of Remoteviews is to display and update the view interface in other processes .

No9:

The REMOTEVEIWS is passed through Binder to the systemserver process because remoteviews implements the parcelable interface, so it can be transferred across processes , the system will get the resources of the application based on such information as the package name in Remoteviews. The layout file in the Remoteviews is then loaded via Layoutinflater

No10:

The notification bar and desktop widgets are managed by Notificationmanager and Appwidgetmanager , respectively, and Notificationmanager and Appwidgetmanager through binder respectively and systemserver in the process of Notificationmanagerservice and Appwidgetservice for communication.

NO11:

Theoretically, the system can fully support all view and view operations through binder, but it is too expensive to do so because there are too many ways to view it, and a large number of IPC operations can affect efficiency.

To solve this problem, the system does not directly support view's cross-process access through binder, but rather provides an action concept, the action represents a view operation, and the action also implements the Parcelable interface.

The advantage is that there is no need to define a large number of binder interfaces, followed by a large number of IPC operations to improve the performance of the program.

No12:

The remote process uses Remoteviews's apply method to update the view, and the Remoteviews's apply method iterates through all the action objects and invokes their apply method, specifically The view update operation is done by the Action object's apply method .

NO13:

Remoteviews's Apply method first loads the layout file in the Remoteviews (obtained through Getlayoutid) through Layoutinflater, and the layout file is loaded through performapply To perform some update operations.

NO14:

The apply method of the Action object is where the view is actually operated .

NO15:

When calling the set method of Remoteviews, they are not immediately updated with their interface, but must pass through the Notificationmanager notify method and the Appwidgetmanager Updateappwidget to update their interface.

"Android Development Art Exploration" reading notes (iv)--remoteviews

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.