Android Window 3: Create an application Window, androidwindow

Source: Internet
Author: User

Android Window 3: Create an application Window, androidwindow



Create application window 1. Create Activity1. the application window must correspond to the Activity. AMS notifies the client ActivityThread to start the Activity. Create Activity object through reflection
2. Create the Window2. activity. attach () method to set internal variables. 3. The activity. attach () method creates a Window object. PolicyManager. makeNewWindow () is created through com. android. internal. policy. impl. policy configuration) Create PhoneWondow and assign it to Activity. in mWindow, set setCallback () [The calback of Window is the current Activity, which is why the user message can be transmitted to the Activity] 4. window. mWindowManager assignment. WindowManager is an interface with two implementation classes Window. LocalWindowManager (a shell, which is implemented in its internal WindowManagerImpl) and WindowManagerImpl
3. Create ViewRoot5. Add a View. Call callActivityOnCreate within the launch mlaunchactivity and call setContentView in onCreate. SetContentView source code getWidnow. setContentView () installDecor () create a title bar, etc. 6. setContentView source code, analysis of Theme related settings 7. after the Activity is ready, notify AMS. AMS calls the Activity. makeVisible () 8. activity. makeVisible () source code. The window type is TYPE_APPLICATION. In ViewGroup. addView, the "level" determines the WindowManager level 9. LocalWindowManager. addView (WindowManagerImpl. addView has only one object for one application), which contains three arrays. Use ViewRoot. setView to complete key addition.
4. Add 10. Save views, ViewRoot, and WindowManager. layoutparams11in the array mViews, mRoots, and mParams. Run ViewRoot. setView to add the last window. MAttachInfo value assignment, requestLayout sends a page layout request for sWindowSession. add to notify WMS to add a window


References:

Android Kernel Analysis Chapter 1 8th create an application window

Graphic Android-Android GUI system (2)-Window Management (View, Canvas, Window Manager)



Android Window mechanism analysis ------ UI Management System (Window level)


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.