APP Analysis in Android system-text message app

Source: Internet
Author: User

The Android operating system itself is a huge open-source software warehouse. Familiar with it, you can understand the design framework of the Android system and obtain efficient application programming methods. The source code analyzed in this article comes from Google's official AOSP source code 4.0.1 _ r1, And the Android version of the mobile phone is CM 4.2.2. For Android system analysis, the operating system version of the mobile phone and the source code version are not significantly different, but if you need to install the changes in the source code to the mobile phone, the most difficult way to solve the problem is to make sure that the system version in the mobile phone is exactly the same as the source code version.

After confirming the registration of the text message app and the main Activity, you can use the software to search for the app (everything is used here) determine that the SMS app is in the source code packages \ apps \ Mms \ src \ com \ android \ mms \ ui, And the startup activity of the SMS app is the ConversationList inherited from ListActivity.

1) Construction of ActionBar

In the onCreateOptionsMenu function, load the menu project by importing conversation_list_menu.

     
 
<menu xmlns:android="http://schemas.android.com/apk/res/android">    <item android:id="@+id/action_compose_new"="@string/new_message"="@drawable/ic_menu_msg_compose_holo_dark"="always|withText" />    <item android:id="@+id/search"="@string/menu_search"="@drawable/ic_menu_search_holo_dark"="ifRoom|collapseActionView"="android.widget.SearchView" />    <item android:id="@+id/action_settings"="@string/menu_preferences"="@android:drawable/ic_menu_preferences" />    <item android:id="@+id/action_delete_all"="@string/menu_delete_all"="@drawable/ic_menu_trash_holo_dark" />    <item android:id="@+id/action_debug_dump"="@string/menu_debug_dump" /></menu>

The setupActionBar () in the oncreate function is used to set the view of the Actionbar, and the number of unread messages can be displayed, but the corresponding view is not displayed on the CM mobile phone.

     == (ViewGroup)LayoutInflater.from(|=

2) listview Construction

In oncreate (), set the properties of listview. setOnCreateContextMenuListener sets ContextMenu. With this option, after you click the listview column, call MENU_VIEW in the onContextItemSelected function: {openThread (threadId); break;

MQueryHandler = View emptyView =
InitListAdapter ();

Initialization of listview. The initListAdapter () in the oncreate function is as follows:

     =  ConversationListAdapter(, 

Related Article

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.