Convert View into bitmap and save it as a picture

Convert View into bitmap and save it as a picture

Research on Activity Startup Process in Android

case LAUNCH_ACTIVITY: {
    final ActivityClientRecord r = (ActivityClientRecord) msg.obj;
    r.packageInfo = getPackageInfoNoCheck(
            r.activityInfo.applicationInfo, r.compatInfo);
    handleLaunchActivity(r, null, "LAUNCH_ACTIVITY");
private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent, String reason) {
    Activity a = performLaunchActivity(r, customIntent);
    if (a != null) {
        r.createdConfig = new Configuration(mConfiguration);
        reportSizeConfigurations(r);
        Bundle oldState = r.state;
        handleResumeActivity(r.token, false, r.isForward,
                !r.activity.mFinished && !r.startsNotResumed, r.lastProcessedSeq, reason);
    }
}

The two most important methods are performLaunchActivity() and handleResumeActivity() .

performLaunchActivity()中:

attach( ) // Create a window that is related to the display of the Activity

onCreate(); // setContentView( ) parses the view in xml and associates it with the decorview

handleResumeActivity()中:

Execute the onResume method in the activity and add the DecorView to the Window from the WindowManager

Add the decorview to the ViewRootImpl, and have the decorview perform operations such as measurement, layout, and drawing.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325173314&siteId=291194637