In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about how to understand the Android open source system. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Android open source system GOOGLE announced in Google on November 5, 2007. the GOOGLE internal meeting is said to be a truly open and complete Android open source system for mobile terminals. I don't know if this information is really correct.
Options menu is displayed by pressing the home key, and context menu needs to be displayed after pressing 2s on the view. Both kinds of menu can add submenus, and submenus cannot be nested. Options menu can only display up to six menu options at the bottom of the screen, called icon menu,icon menu without the checkable option. Menu items more than 6 will be called up in more icon menu.
It is called expanded menu. Options menu is generated through activity's onCreateOptionsMenu, which is called only when the menu*** is generated for the second time. Any idea of changing options menu can only be done in onPrepareOptionsMenu, which is called before the menu is displayed. OnOptionsItemSelected is used to process selected menu items.
Context menu is bundled with a specific view, and registerForContextMenu is used in activity to register context menu for a view. Context menu calls onCreateContextMenu to generate menu before it is displayed. OnContextItemSelected is used to process selected menu items.
Android also provides the ability to group menu items with similar functions into the same group, so that menu properties can be set by calling setGroupCheckable,setGroupEnabled,setGroupVisible without having to set them separately.
Options menu and context menu menus are used in Notepad. First, let's look at the onCreateOptionsMenu function that generates options menu. What on earth is the use of this? In fact, this is a dynamic menu technology (also a bit like the plug-in mechanism), if an activity, its type is "android.intent.category.ALTERNATIVE".
If the data is "vnd.android.cursor.dir/vnd.google.note", the system will add a menu item to the activity. After looking at it in androidmanfest.xml, it is found that none of the activity meets the criteria, so this code does not dynamically add any menu items.
Event handling for context menu items selected is achieved by overloading onContextItemSelected
Switch (item.getItemId ()) {case MENU_ITEM_DELETE: {/ / Delete the note that the context menu is for Uri noteUri = ContentUris.withAppendedId (getIntent (). GetData (), info.id); getContentResolver (). Delete (noteUri, null, null); return true;}} return false
For log deletion, first call ContentUris.withAppendedId (getIntent (). GetData (), info.id); to concatenate the URI of the log to be deleted. Then getContentResolver (). Delete (noteUri, null, null); call the lower-level Content Provider to delete the log.
Without discussing the examples here, let's take a look at the official documentation's introduction to the Activity life cycle.
1Android open source systems use Activity Stack to manage multiple Activity, so only the top Activity is in an active or running state at a time. The rest of the Activity is pinned down.
two。 If the inactive Activity is still visible (that is, if it is pressed against a non-full-screen Activity or transparent Activity), it is in the paused state. In the case of insufficient memory in the system, the Activity in the paused state can be killed by the system. I just don't understand, what will the display on the interface look like if it is killed? It seems necessary to study this situation next time.
3. The pairing of several events can clearly understand their relationship. A pair of Create and Destroy is called entrie lifetime. If resources are allocated during creation, resources are released when they are terminated. On the top, there is a pair of Start and Stop, called visible lifetime, which expresses the process of visible and non-visible. At the top is the pair of Resume and Pause, called foreground lifetime, which expresses the process of whether it is active or not.
4. Therefore, the Activity derived class we implement overloads two important methods: onCreate () for initialization, and onPause () to save the results of the current operation.
The above is the editor for you to share how to understand the Android open source system, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.