Android startActivity()

Have you ever been curious about how startActivity() works? I was thinking what will happen if I put some code after this method call. So I tried out.

The result is more or less as I expect. The code after startActivity() executes and then the new activity comes to foreground. So I guess there are a few things behind this simple call.

(1) of course, it is non-blocking. Invoking it tell the Android OS (or the main thread? of the app process) that a new activity is requested.

(2) after the control returns back to the main thread (??), i.e., the function containing startActivity() returns, the main thread will take care of the request.

猜你喜欢

转载自blog.csdn.net/Andrew659/article/details/7641317