Android Basics (ii)

Source: Internet
Author: User
Tags message queue

  • ADB process
  • ADB directives

    • ADB install xxx.apk
    • ADB Uninstall Package Name
    • ADB devices
    • ADB start-server
    • ADB kill-server
    • ADB shell–> access to Linux command line
      • Ls–> display file and package name
      • Ps–> enumeration of all running processes
      • rm–> Deleting files
      • Cd–> Switching directories
    • ADB push file path/filename sdcard/file name –> put the file in.
    • ADB pull sdcard/file name –> pulls the file out, and in which it executes.
  • Android Development Environment

    • Sdk–> Software Development Kit
    • Eclipse–> Android Studio instead of Eclipse
    • Adt:eclipse Plugin –> Android development tool
  • Ddms–> Commissioning Service
    • View Android devices
    • Console output
    • Call the simulator and send a text message.
  • Android Project directory structure
    • Assets: Larger resource file, no resource ID, read with IO stream
    • Libs: Third-party jar packages
    • Res: Resource file with resource ID
  • button click event
    • Set listening
    • OnClick Property
  • Five common layouts of Android
    • Linear –> Vertical is up and down invalid, level is left or right invalid
    • Relative
    • Frame –> can only align the parent element up or down
    • Table:tablerow–> represents rows, and child nodes represent columns
    • Absolutely
  • Log–> custom Levels and tags
    • 5 levels of console output
    • Log.v–> Printing Redundancy Information
    • Log.e
  • Unit Test Framework
    • Androidtestcase
    • Instruction set "Instrumentation:targetpackage target package, and which package you want to test" and class library "Uses-library"
  • Data storage
    • File read and write: internal storage, external storage path
    • Sharedpreference
      • Saving data as key-value pairs
      • Save to XML file
    • Database SQLite Database
    • ContentProvider
      • Keep the data in someone else's private file
  • Parsing XML generation
    • XmlSerializer, Serializer
    • DOM (the entire document is loaded into memory), SAX, pull "after two are read one line parsing a row, Google recommended Pull"
    • Pull Event Type
      • Start_document
      • End_document
      • Start_tag
      • End_tag
      • TEXT
  • SQLite database
    • Sqliteopenhelper: Creating a Database
    • 4 parameters of the construction method
    • Sqlitedatabase: Delete and change
    • Primary key: _id
  • ListView: for displaying lists
    • An entry is a view object that can be populated with a layout file
    • Set Adapter
    • GetCount: Get the total number of entries
    • GetView: Gets the View object as an entry display
    • Once a screen is drawn, the entry is cached
    • The next time the GetView method is called, the cache is passed in
  • Network requests
    • URL Objects encapsulate URLs
    • Open Connection Object
    • Setting the Connection object
      • Request Method Get/post
      • Connection/Read timeout
    • Send a request to get the corresponding code
    • The server passes the requested data over the stream to the client
  • Message Queuing mechanism
    • The MessageQueue and Looper objects are created when the main thread [itself is a dead loop] is created
    • Programmers create Handler objects
    • Message Queue message, Looper "have Looper thread to create message queue" to take the message out, to handler, trigger Handlemessage call, child threads do not have Looper, can only be created by themselves, so as to create handler
    • Send message: SendMessage
      • Sends the message to the message queue of the thread that created the handler
    • Message carrying data
      • What
      • Obj
      • Setdata:bundle
  • Android Four components
    • Activity
    • Service
    • Broadcastreceiver
    • ContentProvider
  • Activity
    • life cycle:
      • oncreate
      • onstart
      • onresume
      • onpause
      • onstop
      • ondestroy
      • onrestart
    • start mode:
      • startactivi Ty
      • startactivityforresult–> return data when destroying
      • callback onactivityreslut–> return data
    • start Dynamic mode:
      • standard –> default, Stander
      • singletop–> is not created on the top of the stack
      • singletask–> Stack, Destroy the
      • singleinstance–> system will use the "Call interface", we generally do not need to ensure that only one in memory
  • Intent
    • Activity jump
    • Service startup
    • Broadcast Send
    • Explicit intent: Specify the byte code of the target Activity/service "local application, directly with. Class"
    • Implicit intent: Set Intent object to match intent-filter "remote Application"
    • Can encapsulate data
      • Eight basic data types and their arrays
      • string and its array
      • Bundle
      • Objects that implement a serialized interface
        • serializable–> Java provides, localize, persist objects or interact with the server to do data with it
        • Parcelable–> Android self-defined for in-memory delivery
  • Broadcast recipient
    • What broadcasts are received through the Intent-filter definition
    • Priority can be set, valid for ordered broadcasts
    • Orderly broadcast
      • Prioritize received orders by priority
    • Shuffle broadcast
      • No order of Precedence
      • Cannot intercept, cannot modify broadcast content
  • Service
    • Starting mode
      • StartService
        • Service process
        • Service doesn't have a dime relationship with activity.
        • Oncreate-onstartcommand-ondestroy
      • Bindservice
        • Process priority does not change
        • Services and Activity die
          • Oncreate-onbind-onunbind-ondestroy
    • Process priority
      • Foreground process
      • Visible process
      • Service process
      • Background process
      • Empty process
      • First kill priority low, the same priority, LRU "least recently used" count the legal life and death
  • Aidl–> Android Interface Definition language for process communication
    • Change the interface file suffix name to Aidl
    • Public is the default in Aidl and does not require or allow the definition of access modifiers
    • Intermediary object Inheritance stub
    • Copy the Aidl to the initiator's app, the package name must be the same
    • Bind time to get the middleman object, Stub.asinterface strong turn
  • ContentProvider:
    • Share Private data
    • Improve security, you can define sharing rules
    • URI Matching Device
      • Match what is carried at the end of the URI
    • Contentobserver: Receive notifications when content providers change the database
  • Player
    • MediaPlayer: Music video
    • Surfaceview: Video Playback
      • Surfaceholder
      • Created when visible, destroyed when not visible
  • Camera

    • Activate the activity that comes with the system
      • Custom
        • Camera: Take photos
        • Surfaceview: Display Preview interface
  • Image processing

    • All pixel information of the picture is parsed when the picture is loaded
    • Use ARGB to save pixel information in memory, which is 32-bit color and takes 4 bytes
    • Compress pictures before loading

Android Basics (ii)

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.