Android Adapter Anatomy understanding

Source: Internet
Author: User

    • UI controls are all about adapter (adapters)
    • Adapter: Is the intermediate bridge used to help the control populate the data (most of the textview controls in development depend on the database for delivery and display, such as: News Class)
    • Adapter: Display the various data in the appropriate form to the view (I am the control that shows the picture, you send me the text is not want to good, break up!) )
    • Adapter: Need to combine ListView, GridView and so on Collection class control (List in learning Java collection should have met, GridView nine Gongge do not explain in the blog park to search a lot of explanation)

Divide an app page into three chunks: UI control (View), Data mode (model), controller it 's adapter's Big brother.

    • Model: Responsible for executing the core operation of the program and Judgment logic, through the view to obtain user input data, and then according to the information from the database query, the final operation and judgment, and then the results are given to the view to display (diligent administrator responsible for the warehouse query and collation)
    • View: The user's operating interface, plainly is the GUI, which interface components should be used, the arrangement between the components of the position and order need to design (painter use, brush "interface comparison abstract" can be understood as how to use the brush to display on the screen must know where to write (coordinates))
    • controller: As the hub between model and view, it is responsible for the execution process of the control program and an interaction between the objects (model and view the Cold War depends on my "light bulb" (controller) to relay , and must be delivered by an exact words)

Model (data)---> Controller(in what way)---> View(user interface)

View(I want to show pictures, text)--->Controller(Analyze what she wants, oh want pictures)--->Model(search for the corresponding picture information)

MVC pattern Diagram

Adapter Kinship Map (image source http://www.runoob.com/w3cnote/android-tutorial-adapter.html) I also study here and make a simplified record on my own and add a bit of subjective thinking inside.

    • baseadapter: Abstract class, in actual development we will inherit this class and rewrite the related method, the most used one adapter!
    • arrayadapter: Support generic operation, the simplest of a adapter, can only show a line of text ~ //Now the video teaching is to use this class in teaching (I see that)
    • Simpleadapter: A adapter that also has good extensibility, you can customize a variety of effects! Can put on imageview (picture) and so on, can display more complex lists, including each line display pictures, text, etc., but not to the list of post-processing (in Java code), is simply responsible for the display
    • simplecursoradapter: A ListView for displaying simple text types, usually used in the database, but a bit outdated, not recommended!
    • (the author of the site said that) in fact, a baseadapter is enough to play, as for the other, the actual development of use is not much. "I agree."

Android Adapter Anatomy understanding

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.