Precautions for building the Android platform

Source: Internet
Author: User

The Establishment of The Open Mobile Alliance developed by GOOGLE and the launch of Android are significant changes to the current situation. Prior to the initial benefits, this system is a very powerful and cost-effective Android platform, in order to make these Android platforms run better.

Similar to the WinMain function in win32 programs, Android naturally has its program entry point. It is specified through configuration in the AndroidManifest. xml file. You can see that there is such an intent-filter under the activity node named NotesList, and its action is android. intent. action. MAIN,

Android platform is specified as android. intent. category. LAUNCHER, which indicates that this activity is used as the entry activity. After the system finds it, it will create an Android platform instance for running, if not found, it will not be started (you can change the MAIN name to try ). Then, call the managedQuery function to query all log information.

The first parameter is the URI "contentcom. google. provider. NotePad/notes" set above, that is, the notes data table. The PROJECTION field specifies the fields required in the results, and Notes. DEFAULT_SORT_ORDER specifies the sorting rules for the results.

In fact, managedQuery does not directly query the database, but uses the Content Provider to perform actual database operations. In this way, the logical layer and the database layer are separated. After querying the log List, construct a CursorAdapter and use it as the data source of the List View.

The log list is displayed on the page. The second parameter is R. layout. noteslist_item. Open the corresponding noteslist_item.xml file. So what will happen after the above startActivity (new Intent (Intent. ACTION_EDIT, uri) is executed? At this time, the Android system will jump out and take over.

It will find the corresponding activity based on the information in intent. Here, it finds the activity NoteEditor, and then creates and runs the activity instance. Then, how does Android find the corresponding activity of NoteEditor? This is the time when intent plays a role.

 
 
  1. <intent-filter android:label="@string/resolve_edit"> 
  2.               <action android:name="android.intent.action.VIEW" /> 
  3.               <action android:name="android.intent.action.EDIT" /> 
  4.               <action android:name="com.android.notepad.action.EDIT_NOTE" /> 
  5.               <category android:name="android.intent.category.DEFAULT" /> 
  6.               <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> 
  7.           </intent-filter> 

Use the "adb shell" command in the command line to enter the system, and then "cd app" to enter the directory where the application is located. "rm XXX" can delete the specified apk, this removes the icons occupied by the system's top-layer interface. If "cd data" is used twice, you can enter the data directory used by the application.

Your data can be stored here. For example, the Android platform stores its database in its databases directory named note_pad.db. it will be slow to start the simulator for the first time, but don't shut down the simulator in the future. You don't need to start the simulator again after you modify the code or debug it.

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.