开发者

Android Process Synchronization

Are th开发者_开发知识库e processes in android asynchronous? If they are asynchronous then how can we conclude when the activity or process is finished or completed its execution.


Are the processes in android asynchronous?

Processes are neither synchronous or asynchronous, in any operating system. Forking processes is frequently asynchronous.

Since, at the SDK level, you are generally unaware of what is going on in terms of processes, this question is moot for Android. Besides, just about everything in Android is asynchronous -- startActivity(), for example.

how can we conclude when the activity or process is finished or completed its execution.

Generally, you should not care.

You can specially construct a pair of activities, where the first activity uses startActivityForResult() and the second activity calls setResult(). Then, the first activity will be called with onActivityResult() to supply the result from the second activity. The result is triggered when the second activity closes (e.g., second activity calls finish(), user presses BACK button).


The Application Fundamentals developer documentation explains Android processes, threads, and lifecycle events.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜