Android day1_ Quick Start

Source: Internet
Author: User

---1--------------------------------------------------Mobile phone format 3G, 4G g:generation1g: Cellular   Call is locked in a certain frequency of 2g:gsm, CDMA and other digital phones   stable call quality, Internet WAP, etc.         gsm:2g    G        edge:2.5g   &NBSP;E3G: Faster speeds, stronger phone performance   Multiple media formats, video calling, etc.   & nbsp     3g:       3G    domestic 3G standard 3         3.5g:    H4G: Faster speed Fast, HD online video, video conferencing         td-lte:        fdd-lte :      Buy mobile phone Attention Network format: &NBSP;&NBSP;2G standard:    &NBSP;GSM: Mobile/unicom     &NBSP;CDMA: Telecom  3g format:      WCDMA: China Unicom             World wide     &NBSP;TD-SCDMA: Mobile         Mobile, Pakistan &N Bsp    cdma2000: Telecom         Japan, telecom  4g:     fdd-lte: Telecom/Unicom      td-lte: Mobile/Telecom/Unicom  1g:      outright exit from the historical stage   2G    dial-up internet     Bandwidth 12.2K per user 3g    Broadband internet     bandwidth 384~2m per user 4g  &nbspFiber-to-household     bandwidth can reach 100M per user   ---2----------------------------------------------------------------------The difference between a JVM and a DVM: Jvm:.java->.class->.jar architecture: Stack-based architecture stack: A data structure in memory Dvm:.java->.class->.dex (with and only one, improving efficiency) . apk based on a register-based schema register: A pointer to a storage unit in the CPU registers the contents of the DVM in the memory of the pointers, such as an application, to operate a local image of the hard disk, the first step to read the image into memory can be manipulated, the picture read into memory is the memory address of the picture , there is a pointer, the JVM memory address is stored in the stack, the DVM memory address is saved in the register, the CPU reads the contents of the register is certainly faster than reading the contents of the stack, so the DVM is a step faster; Android's new virtual machine Art:dalvik: Every time the app runs , byte codes need to be converted to machine code via an instant compiler, which slows down the efficiency of the application. ART: When the application is first installed, the bytecode will be pre-compiled into machine code (pre-Convert the Java instruction to C instruction, save the C command locally, run the pre-converted C command directly the next time you run it), make it a true native application, and the application start and execution speed will be significantly improved But art uses more memory than the Davik application because the art virtual machine saves the pre-compiled machine code in addition to the bytecode of the application itself, rather than having to perform the re-compilation every time, which is a way of sacrificing storage efficiency for execution efficiency; ---3-----------------------------------------------------------------------SDK directory structure See picture ---4-----------------------------------------------------------------------Simulator-Create See picture RAM is the phone's running memory, is to run the program, the speed of the program to run, just look at the amount of RAM remaining space, is like a computer memory, ROM is the cell phone's own space, let you use to put things, such as the computer's hard disk RAM can not store data after power loss, That is, after the Ram power is lost, the RAM memory data must be powered ROM can be stored after the power loss data. General hard disk, USB flash drive are ROM type, memory bar is RAM ---5-----------------------------------------------------------------Create Android project     See video Android architecture  ---6--------------------------------------------------------------- - android project directory Structure  activity: The interface displayed when the app is opened &NBSP;--SRC: Project code     |---package  com.ithmac.hello          |---mainactivity.java          (Java class, this class is automatically generated, which is the Hello interface that was originally seen, can be changed)--gen:    |---Package  com.ithmac.hello: Can the app debug          |--- buildconfig.java              (auto-generated, don't change)            |--- R.JAVA&NBSP: Resources for all resource files in the project id                (auto-generated, don't change)                 (there are many static final classes)                 (there are many static integer constants defined: these Static integer constants are all resource IDs used in Android       --android4.3: Compiled version     |---Android.jar-d:\adt-bundl ......        (Android jar, the only reason to use the Android API is because the jar package was imported) &NBSP;--ANDROID&Nbsp;dependencies    |---android-support-v4.jar - d:\workspace\......      ( In order to be compatible with the high version features can be used on the lower version of the system, is a compatible package, the system automatically imported, in some cases can be deleted, but in libs delete)       (real location under Libs)--libs: Import third-party jar package     |---android-support-v4.jar      (the Compatibility Pack is not a third-party package, but it is also here)  --assets: Storing resource files, such as MP3, video files       (resources in this folder are not resource IDs, read references with IO streams)--bin: Store application compiled packaged files     |---classes.dex    |---project name. apk       (Eclipse Auto-pack)--res: Store resource files       (all resource files stored in this folder will generate resource IDs)       ( Resource ID cannot appear in Chinese, file name cannot be the same as Java naming specification)     |---drowable-hdpi: storing picture resources        |---center.png                     The           (72*72)   &N BSP, |---drpwable-ldpi        |---center.png          (minimum screen rate)     |---drpwable-mdpi                android        ---center.png          (48*48)     |---drpwable-xdpi                  center.png          |---,       and nbsp (96*96)    ---drpwable-xxdpi                      &NBSP ; |---center.png          (144*144)--layout: Store layout files, all layout files in Android are XML files       ( Assign the layout file to the activity through the resource ID, the interface will show the layout of the layout file definition--menu: Menu configuration folder, save menu configuration file, decide menu style--values:r.java No values inner class     |---strings.xml: store string resources, each resource will have a resource id,name id      (there is a string inner class in R.java)     |--- Dimens.xml: Length resource file, definition length of resource id      (DP: Wirelessly length unit, length not fixed)       320*480      & nbsp     20dp           20px      720*1280        &N Bsp 20dp          &NBSP;40px    |---styles.xml: style and theme resource files, define styles and themes, name is their resource ID  -- VALUES-SW600DP--VALUES-V11--VALUES-US1) Dimens.xml to do screen adaptation, multiple values, each of the values corresponding to a dimens.xml2) internationalization, the text of multiple countries need multiple values , one of the values can only have one strings.xml  each strings.xml corresponds to a language, creating a values-us folder directly    ---7--------------------------------------------------------------------  android configuration file (manifest file)  ---androidmainfest.xml  specifies the app's package name <manifestpackage= "Com.itheima.helloworld" ( Application in the system of the unique identification, and the code package does not matter, just happen to name the same, can also play different) android:versioncode= "1"     app version number, who is large who is high version   system look Android: Versionname= "1.0"     ><applicationandroid:icon= "@drowable/center"     Specify an app icon in Downloud android:label= "@string/app_name"   Specify the app name in Downloud >      <activity    If there is no  label,icon of your own designation, you will use label,icon        android:name= defined in <application. Com.ithemac.hello.MainActivity "        android:label=" @string/lizhi "        & nbsp   Specify screen app name         android:icon= "@drowable/photo2"   Specify screen app icon         >        <intent-filter>  determines the portal interface for Android apps, which interface has it, which interface is the Android Portal interface             <action android:name= "Android.intent.action.MAIN"/>     &nbsP       <category android:name= "Android.intent.category.LAUNCHER"/>        </intent-filter>  data/data/com.itheima.helloworld (the package name specified in the code above)   The four basic components of Android are Activity,service services, content provider content providers, Broadcastreceiver broadcast receivers. The four components of  android all need to be configured in the manifest file before use  ---project.properties    target=android-18  Here you can also modify the compiled version   ---8---------------------------------------------------------------------------- Program packaging and Android process     See picture. APK Installation Path:    Third-party app save path:data/app    System app save path: system/app data/ data/Package Name folder: The system generates a dedicated folder for each application to save the file  1 the app generates during the run. Generate. apk files     1) compile All. class files, generate. dex Files     2 Compile the resources file          1>xml resource file from text format to binary format          2> Generate Resource Index Table RESOURCES.ARSC, equivalent to a Resource Index Table (Android Resource Packaging tool AAPT The following two additional actions are performed during the compilation and packaging of resources:        1.  Give each non-assets resource an ID value that is defined in a constant form in a R.java file.         2.  generates a RESOURCES.ARSC file that describes the configuration information for a resource with an ID value, and its content is equivalent to a resource Index table. With the resource ID and the Resource Index table, the Android resource management Framework can quickly locate the most matching resources based on the device's current configuration information. )          3> prepare non-compiled files          4> inventoried files androidmanifest.xml file conversion to binary & nbsp        5> use Debug.keystore to package and sign the entire application 2. Load the. apk file into the emulator     Add the apk file to the/data/local/tmp /xxx.apk    After installation is complete, the system automatically deletes. APK installation package  3. Install apps     installation path:    Third-party app save path:data/app  &nbsP System Application Save path:system/app     data/data/Package name folder:    system generates a dedicated folder for each application to save the files generated by the app during the run. is also the path to the internal storage space     ---9------------------------------------------------------------------------Ddmsdalvik Debug Monitor Service Dalvik virtual Machine Debug Monitoring Services Ddms:devices: List all the Android device file Explorer that is currently connected to your eclipse: View the document directory Structure Emulator control: Simulator Controls |---Speed: Set the emulator to debug at a low speed will not have a bug |---Incoming number: Caller ID |---SMS: SMS (SMS only, not Receive text messages, not yet Chinese) (Test and SMS-related code) |---Voice: call the tab in the DDMS to drag it directly to the Java interface   ----------------------------------------------------------------------------ADB: Process consumes 5037 ports Android Debug Bridge (Android Debug Bridges) 1) Establish connection between Eclipse and Android device cmd can control abd process via adb command: adb start-server boot A DB instruction adb kill-server kill adb command adb install E:\yyh.apk installation adb instructions adb ininstall app package name uninstall ADB instructions ADB devices list Android devices connected to the development environment List of adb shells into Android command line |---ls list android Directory |---CD data into the Data directory |---PS list all the processes on my Android Device Netstat-ano (window Directive) to view when Pre-system environment lower port occupancy situation because the ADB occupies the port number is 5037, the inside should run the ADB related process, but sometimes by other rogue programs occupy the process, so the rogue process to find out, kill ----------------------------------------------------------------------------------Wirelessly all components in the layout must be wide or high, or they will be error- -------------------------------------------------------------------------------- Phone Dialer button Click event 1th method: Inner class -------------------------------------------------------------------------------------------- -- 4 Click events for buttons

Android day1_ Quick Start

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.