{"id":280582,"date":"2016-11-08T09:10:04","date_gmt":"2016-11-08T06:10:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=280582"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=280582","title":{"rendered":"\u0411\u0435\u0433\u043b\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 Async-Await \u0432 Android"},"content":{"rendered":"<h5>\u041e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430<\/h5>\n<p>  <\/p>\n<p><i>\u042d\u0442\u043e \u043c\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c. \u042f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u043b\u043e\u0432\u0430 <strong><a href=\"https:\/\/en.wikipedia.org\/wiki\/Coroutine\">\u0441oroutine<\/a><\/strong>, \u0447\u0435\u043c <strong><a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0421\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\">\u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/a><\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0438\u0434\u0435\u0438 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0443\u0437\u043d\u0430\u0442\u044c.<\/i><\/p>\n<p>  <\/p>\n<p>Kotlin \u0432\u0435\u0440\u0441\u0438\u0438 1.1 \u043f\u0440\u0438\u043d\u0435\u0441\u0435\u0442 \u0432 \u044f\u0437\u044b\u043a <a href=\"https:\/\/github.com\/Kotlin\/kotlin-coroutines\">coroutin&#8217;\u044b<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u043e\u0447\u043a\u0435 \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0445 \u043f\u043e\u0437\u0434\u043d\u0435\u0435. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u044d\u0442\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u2014 <a href=\"http:\/\/blog.stephencleary.com\/2012\/02\/async-and-await.html\">async-await<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 C# \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 android \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 I\/O \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438, \u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430, \u0430 \u0442\u0430\u043a \u0436\u0435, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u043c UI \u0438\u0437 \u0444\u043e\u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u041d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u043b\u0435\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0438 \u0443\u0445\u043e\u0434\u044f\u0442 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u043f\u0440\u0438\u0435\u043c\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435, \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u0441\u0435\u0442 \u0441 \u0441\u043e\u0431\u043e\u0439 async-await.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/h2>\n<p>  <\/p>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f Github \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0438\u0445 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u043e, \u043c\u044b \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435. \u042f \u043d\u0435 \u0445\u043e\u0447\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0451 \u0441\u0430\u043c\u0438 \u0437\u0430 \u0441\u0435\u0431\u044f.<\/p>\n<p>  <\/p>\n<h4>\u0421\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 Thread<\/h4>\n<p>  <\/p>\n<p><i>\u0420\u0443\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c<\/i><\/p>\n<p>  <\/p>\n<pre><code>fun threads() {   val handler = Handler()    Thread {     try {       val user = githubApi.user()       userRepository.store(user)       handler.post {         threadsTV.text = &quot;threads: [$user]&quot;       }     } catch(e: IOException) {       handler.post {         threadsTV.text = &quot;threads: [User retrieval failed.]&quot;       }     }   }.start() }<\/code><\/pre>\n<p>  <\/p>\n<h4>AsyncTask \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430<\/h4>\n<p>  <\/p>\n<p>\u041d\u0438\u043a\u0442\u043e \u0436\u0435 \u0438\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0432\u0435\u0440\u043d\u043e?<\/p>\n<p>  <\/p>\n<pre><code>fun asyncTask() {   object : AsyncTask&lt;Unit, Unit, GithubUser?&gt;() {      private var exception: IOException? = null      override fun doInBackground(vararg params: Unit): GithubUser? {       try {         val user = githubApi.user()         userRepository.store(user)         return user       } catch(e: IOException) {         exception = e         return null       }     }      override fun onPostExecute(user: GithubUser?) {       if (user != null) {         asyncTaskTV.text = &quot;asyncTask: [$user]&quot;       } else {         asyncTaskTV.text = &quot;asyncTask: [User retrieval failed.]&quot;       }     }   }.execute() }<\/code><\/pre>\n<p>  <\/p>\n<h4>Callbacks<\/h4>\n<p>  <\/p>\n<p><i>\u0410 Callback-hell \u043a\u0442\u043e-\u043d\u0438\u0443\u0431\u0434\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442?<\/i><\/p>\n<p>  <\/p>\n<pre><code>fun callbacks() {   githubApi.userFromCall().enqueue(object : Callback&lt;GithubUser&gt; {      override fun onResponse(call: Call&lt;GithubUser&gt;, response: Response&lt;GithubUser&gt;) {       val user = response.body()       userRepository.storeCallback(user) {         callbacksTV.text = &quot;callbacks: [$user]&quot;       }     }      override fun onFailure(call: Call&lt;GithubUser&gt;, t: Throwable) {       if (t is IOException)         callbacksTV.text = &quot;callbacks: [User retrieval failed.]&quot;       else         throw t     }   }) }<\/code><\/pre>\n<p>  <\/p>\n<h4>Rx<\/h4>\n<p>  <\/p>\n<p><i>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u0440\u0443\u0442\u044b\u0435 \u0432\u0435\u0449\u0438&#8230;<\/i><\/p>\n<p>  <\/p>\n<pre><code>fun rx() {   githubApi.userRx()       .flatMap { user -&gt;         userRepository.storeRx(user).toSingle { user }       }       .observeOn(AndroidSchedulers.mainThread())       .subscribe(           { user -&gt;             rxTV.text = &quot;rx: [$user]&quot;           },           { throwable -&gt;             if (throwable is IOException)               rxTV.text = &quot;rx: [User retrieval failed.]&quot;             else               throw throwable           }       ) }<\/code><\/pre>\n<p>  <\/p>\n<h4>Async-Await<\/h4>\n<p>  <\/p>\n<p><i>\u0410 \u043a\u0430\u043a \u0432\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u044d\u0442\u043e?<\/i><\/p>\n<p>  <\/p>\n<pre><code>fun asyncAwait() = asyncUI {   try {     val user = await(githubApi.userAsync())     await(userRepository.storeAsync(user))     asyncAwaitTV.text = &quot;asyncAwait: [$user]&quot;   } catch(e: IOException) {     asyncAwaitTV.text = &quot;asyncAwait: [User retrieval failed.]&quot;   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 <strong>asyncUI<\/strong> (\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 <strong>async&lt;\u0422&gt;<\/strong>) \u043c\u0435\u0442\u043e\u0434 \u0432\u043a\u043b\u044e\u0447\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b coroutin&#8217;\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <strong>await<\/strong>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 <strong>await<\/strong>, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d, \u043d\u043e \u043f\u043e\u0442\u043e\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0432\u044b\u0437\u043e\u0432, \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e coroutine \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0441\u0432\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u041c\u0435\u0442\u043e\u0434 <strong> asyncUI<\/strong> \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435.<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, coroutine \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430. \u041e\u043d\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 kotlin 1.1-M02. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 async-await \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/github.com\/nhaarman\/AsyncAwait-Android\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b<\/a> \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f coroutines \u043d\u0430 Android. \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e coroutin&#8217;\u0430\u0445, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/github.com\/Kotlin\/kotlin-coroutines\/blob\/master\/kotlin-coroutines-informal.md\">\u043d\u0435\u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c<\/a><\/p>\n<p>  <\/p>\n<p>PS: \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0442\u043c\u0435\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0445\u043e\u0436\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u043e \u0431\u0435\u0437 \u0443\u0442\u0435\u0447\u0435\u043a.<\/p>\n<p>  <\/p>\n<p><i>\u0412 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f.<\/i><\/p>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/314574\/\"> https:\/\/habrahabr.ru\/post\/314574\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<h5>\u041e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430<\/h5>\n<p>  <\/p>\n<p><i>\u042d\u0442\u043e \u043c\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c. \u042f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u043b\u043e\u0432\u0430 <strong><a href=\"https:\/\/en.wikipedia.org\/wiki\/Coroutine\">\u0441oroutine<\/a><\/strong>, \u0447\u0435\u043c <strong><a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0421\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\">\u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/a><\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0438\u0434\u0435\u0438 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0443\u0437\u043d\u0430\u0442\u044c.<\/i><\/p>\n<p>  <\/p>\n<p>Kotlin \u0432\u0435\u0440\u0441\u0438\u0438 1.1 \u043f\u0440\u0438\u043d\u0435\u0441\u0435\u0442 \u0432 \u044f\u0437\u044b\u043a <a href=\"https:\/\/github.com\/Kotlin\/kotlin-coroutines\">coroutin&#8217;\u044b<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u043e\u0447\u043a\u0435 \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0445 \u043f\u043e\u0437\u0434\u043d\u0435\u0435. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u044d\u0442\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u2014 <a href=\"http:\/\/blog.stephencleary.com\/2012\/02\/async-and-await.html\">async-await<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 C# \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 android \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 I\/O \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438, \u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430, \u0430 \u0442\u0430\u043a \u0436\u0435, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u043c UI \u0438\u0437 \u0444\u043e\u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u041d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u043b\u0435\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0438 \u0443\u0445\u043e\u0434\u044f\u0442 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u043f\u0440\u0438\u0435\u043c\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435, \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u0441\u0435\u0442 \u0441 \u0441\u043e\u0431\u043e\u0439 async-await.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-280582","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=280582"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280582\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}