{"id":310429,"date":"2020-09-24T15:00:32","date_gmt":"2020-09-24T15:00:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=310429"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=310429","title":{"rendered":"Retrofit2 \u043d\u0430 Android \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Kotlin"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/520544\/\">\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 <b>Retrofit<\/b> 2. \u041f\u0440\u0430\u0432\u0434\u044b \u0440\u0430\u0434\u0438 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0449\u0435 \u0441 2 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e <b>Picasso<\/b> \u0438 <b>Spots-dialog<\/b>.<\/p>\n<p>  \u042d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043a \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 Retrofit 2. \u0412\u0435\u0434\u044c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u043b\u0438.<\/p>\n<h4>0. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Android Studio, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Empty Activity. \u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0443 \u043d\u0430\u0441 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 Kotlin.<\/p>\n<h4>1. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/h4>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 build.gradle \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<pre><code class=\"java\">dependencies {     implementation 'com.squareup.retrofit2:retrofit:2.9.0'     implementation 'com.squareup.retrofit2:converter-gson:2.5.0'     implementation 'com.squareup.picasso:picasso:2.71828'      \/\/noinspection GradleCompatible     implementation 'com.android.support:design:28.0.0'     implementation 'com.github.d-max:spots-dialog:1.1@aar' }<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 Spots progress dialog. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0441\u044f \u0441 \u044d\u0442\u0438\u043c <a href=\"https:\/\/github.com\/dybarsky\/spots-dialog\">\u0437\u0434\u0435\u0441\u044c.<\/a> \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432 build.gradle(Modul:app) \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e:<\/p>\n<pre><code class=\"java\"> compileOptions {         sourceCompatibility JavaVersion.VERSION_1_8         targetCompatibility JavaVersion.VERSION_1_8     }<\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0437\u0430\u0439\u0442\u0438 \u0432 manifests \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430<\/p>\n<pre><code class=\"xml\">  &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;\/&gt;<\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>2. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 data class&#8217;\u043e\u0432<\/h4>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0443\u043d\u043a\u0442\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0430 \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435? \u041f\u0430\u0440\u0441\u0438\u0442\u044c \u0431\u0443\u0434\u0435\u0442 <a href=\"https:\/\/www.simplifiedcoding.net\/demos\/marvel\/\">\u043e\u0442\u0441\u044e\u0434\u0430.<\/a><\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0434\u0430\u043b\u0435\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0438 \u0438\u0434\u0435\u043c <a href=\"https:\/\/jsoneditoronline.org\/#left=local.gidove&amp;right=local.yovani\">\u0441\u044e\u0434\u0430.<\/a> \u0421\u044e\u0434\u0430 \u043c\u044b \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u043d\u0430\u0436\u0430\u043b\u0438 \u043d\u0430 tree \u043d\u0430\u043c \u0432\u044b\u0434\u0430\u043b\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a, \u0440\u0430\u0441\u043a\u0440\u043e\u0435\u043c \u0435\u0433\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 8 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043d\u0435 \u043f\u043e\u043d\u044f\u043b, \u0442\u043e \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u0432\u0430\u043c \u0441\u043a\u0440\u0438\u043d:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3-\/fy\/8n\/3-fy8nvlhui5_x0dfedtrfnyvg0.png\"\/><\/p>\n<p>  \u0422\u043e \u0447\u0442\u043e \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043f\u0440\u0430\u0432\u0430 \u044d\u0442\u043e \u043d\u0430\u0448 \u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \u0430 \u0442\u043e \u0447\u0442\u043e \u0441\u043f\u0440\u0430\u0432\u0430, \u044d\u0442\u043e \u0443\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a Android Studio \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 Model \u0442\u0430\u043c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c kotlin class \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 Movie \u0438\u0437 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c data class, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434 class \u0434\u043e\u0431\u0430\u0432\u0438\u043c data, \u0430 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u043a\u0440\u0443\u0433\u043b\u044b\u0435, \u0434\u0430\u043b\u0435\u0435 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u043a\u0441\u0442\u0430\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043d\u0443\u043b\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"kotlin\">data class Movie(     var name: String? = null,     var realname: String? = null,     var team: String? = null,     var firstapperance: String? = null,     var createdby: String? = null,     var publisher: String? = null,     var imageurl: String? = null,     var bio: String? = null )<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0434\u0430\u0434\u0438\u0442\u0435\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0430\u043f\u043a\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f Model, \u0442\u043e \u044f \u0432\u0430\u043c \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e:<\/p>\n<p>  <b>Model<\/b> \u2014 \u044d\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u044d\u0442\u043e POJO, \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API, \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h4>3. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Client<\/h4>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 Retrofit, \u0430 \u0432 \u043f\u0430\u043f\u043a\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c object, \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e RetrofitClient, \u0434\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e retrofit \u0442\u0438\u043f\u0430 Retrofit, \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 getCleint(baseUrl: String) \u0438 \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f Retrofit. \u0412 \u0442\u0435\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 retrofit&#8217;a \u043d\u0430 null \u0438 \u0435\u0441\u043b\u0438 \u0440\u0435\u0442\u0440\u043e\u0444\u0438\u0442 \u0440\u0430\u0432\u0435\u043d null, \u0442\u043e \u043c\u044b \u043a \u0440\u0435\u0442\u0440\u043e\u0444\u0438\u0442\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c Retrofit.Builder() \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c baseUrl \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c baseUrl \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 addconverterFactory c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c GsonConverterFactory.create() \u0438 \u0431\u0438\u043b\u0434\u0438\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 build() \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0440\u0435\u0442\u0440\u043e\u0444\u0438\u0442 \u0432 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0442\u0438\u043f<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"kotlin\"> import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory  object RetrofitClient {     private var retrofit: Retrofit? = null      fun getClient(baseUrl: String): Retrofit {         if (retrofit == null) {             retrofit = Retrofit.Builder()                 .baseUrl(baseUrl)                 .addConverterFactory(GsonConverterFactory.create())                 .build()         }         return retrofit!!     } }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <b>Builder \u0432 Retrofit<\/b> \u2014 \u044d\u0442\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438 API Builder, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 URL \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 HTTP <\/p>\n<h4>4. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 Interface<\/h4>\n<p>  <b>Interface &#8212;<\/b> \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442 Interface \u0432 \u043d\u0435\u0433\u043e \u043c\u044b \u043a\u043b\u0430\u0434\u0435\u043c Interface \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c RetrofitServieces. \u0421\u043e\u0437\u0434\u0430\u0435\u043c Get \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u043f\u0438\u0448\u0435\u043c \u043a\u0430\u0432\u044b\u0447\u043a\u0438, \u0430 \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0435\u0442\u043a\u0443 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0443 \u043d\u0430\u0441 \u044d\u0442\u043e marvel. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u0441\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 GET \u0438 POST \u0437\u0430\u043f\u0440\u043e\u0441 <br \/>  <b>GET<\/b> \u2014 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430(\u0441\u0430\u0439\u0442\u0430)<br \/>  <b>POST<\/b> \u2014 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/p>\n<p>  \u0425\u043e\u0440\u043e\u0448\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e getMovieList, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c Call \u0442\u0438\u043f\u0430 MutableList, a MutableList \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u0438\u043f\u0430 Movie<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"kotlin\"> import com.example.retrofitmarvel.Model.Movie import retrofit2.Call import retrofit2.http.*  interface RetrofitServices {     @GET(&quot;marvel&quot;)     fun getMovieList(): Call&lt;MutableList&lt;Movie&gt;&gt; }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h4>5. Common<\/h4>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 Common, \u0432 \u044d\u0442\u0443 \u043f\u0430\u043f\u043a\u0443 \u043c\u044b \u043a\u043b\u0430\u0434\u0435\u043c object \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e Common, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 BASE_URL \u0438 \u0432 \u043d\u0435\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0441\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0442\u043a\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u043d\u0435\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e retrofitServices, \u0443 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 get() \u043a \u043d\u0435\u043c\u0443 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c RetrofitClient, \u0430 \u0443\u0436\u0435 \u043f\u043e\u0442\u043e\u043c \u043a RetrofitClient \u043c\u044b \u0441\u0435\u0442\u0438\u043c \u043c\u0435\u0442\u043e\u0434 getClient c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c RetrofitServices::class.java<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"kotlin\"> import com.example.retrofitmarvel.Interface.RetrofitServices import com.example.retrofitmarvel.Retrofit.RetrofitClient  object Common {     private val BASE_URL = &quot;https:\/\/www.simplifiedcoding.net\/demos\/&quot;     val retrofitService: RetrofitServices         get() = RetrofitClient.getClient(BASE_URL).create(RetrofitServices::class.java) }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h4>6. \u041c\u0430\u043a\u0435\u0442<\/h4>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a activity_main.xml \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0443\u0434\u0430 RecyclerView <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">XML<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\"> &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     xmlns:app=&quot;http:\/\/schemas.android.com\/apk\/res-auto&quot;     xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;     android:layout_width=&quot;match_parent&quot;     android:layout_height=&quot;match_parent&quot;     tools:context=&quot;.MainActivity&quot;&gt;      &lt;androidx.recyclerview.widget.RecyclerView         android:id=&quot;@+id\/recyclerMovieList&quot;         android:layout_width=&quot;0dp&quot;         android:layout_height=&quot;0dp&quot;         app:layout_constraintBottom_toBottomOf=&quot;parent&quot;         app:layout_constraintEnd_toEndOf=&quot;parent&quot;         app:layout_constraintStart_toStartOf=&quot;parent&quot;         app:layout_constraintTop_toTopOf=&quot;parent&quot; \/&gt; &lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0412 \u043f\u0430\u043f\u043a\u0435 layout \u0441\u043e\u0437\u0434\u0430\u0435\u043c item_layout \u0432 root element \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c CardView <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">item_layout<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;androidx.cardview.widget.CardView     xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     xmlns:app=&quot;http:\/\/schemas.android.com\/apk\/res-auto&quot;     android:layout_width=&quot;match_parent&quot;     android:layout_height=&quot;wrap_content&quot;     app:cardElevation=&quot;8dp&quot;     android:layout_margin=&quot;8dp&quot;&gt;      &lt;androidx.constraintlayout.widget.ConstraintLayout         android:id=&quot;@+id\/linearLayout&quot;         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;167dp&quot;&gt;           &lt;ImageView             android:id=&quot;@+id\/image_movie&quot;             android:layout_width=&quot;0dp&quot;             android:layout_height=&quot;100dp&quot;             android:layout_marginEnd=&quot;8dp&quot;             android:layout_marginRight=&quot;8dp&quot;             app:layout_constraintBottom_toBottomOf=&quot;parent&quot;             app:layout_constraintEnd_toStartOf=&quot;@+id\/txt_name&quot;             app:layout_constraintHorizontal_bias=&quot;0.0&quot;             app:layout_constraintStart_toStartOf=&quot;parent&quot;             app:layout_constraintTop_toTopOf=&quot;parent&quot;             app:layout_constraintVertical_bias=&quot;0.238&quot; \/&gt;          &lt;TextView             android:id=&quot;@+id\/txt_name&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_marginStart=&quot;192dp&quot;             android:layout_marginLeft=&quot;192dp&quot;             android:layout_marginTop=&quot;16dp&quot;             android:text=&quot;name&quot;             android:textColor=&quot;@android:color\/black&quot;             android:textSize=&quot;20sp&quot;             android:textStyle=&quot;bold&quot;             app:layout_constraintStart_toStartOf=&quot;parent&quot;             app:layout_constraintTop_toTopOf=&quot;parent&quot; \/&gt;          &lt;TextView             android:id=&quot;@+id\/txt_team&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_marginStart=&quot;196dp&quot;             android:layout_marginLeft=&quot;196dp&quot;             android:layout_marginTop=&quot;8dp&quot;             android:text=&quot;team&quot;             android:textColor=&quot;@android:color\/black&quot;             android:textSize=&quot;16sp&quot;             android:textStyle=&quot;normal&quot;             app:layout_constraintStart_toStartOf=&quot;parent&quot;             app:layout_constraintTop_toBottomOf=&quot;@+id\/txt_name&quot; \/&gt;          &lt;TextView             android:id=&quot;@+id\/txt_createdby&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_marginStart=&quot;184dp&quot;             android:layout_marginLeft=&quot;184dp&quot;             android:layout_marginTop=&quot;12dp&quot;             android:text=&quot;createdby&quot;             android:textColor=&quot;@android:color\/black&quot;             android:textSize=&quot;18sp&quot;             android:textStyle=&quot;italic&quot;             app:layout_constraintStart_toStartOf=&quot;parent&quot;             app:layout_constraintTop_toBottomOf=&quot;@+id\/txt_team&quot; \/&gt;       &lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;  &lt;\/androidx.cardview.widget.CardView&gt;<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h4>7. Adapter<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 Adapter, \u0432 \u043d\u0435\u0433\u043e \u043c\u044b \u043a\u043b\u0430\u0434\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e MyMovieAdapter<br \/>  <b>Adapter <\/b> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 View \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0412 \u043a\u043b\u0430\u0441\u0441\u0435 MyMovieAdapter \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 private val movieList: MutableList \u0442\u0438\u043f\u0430 Movie \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443 \u043d\u0430\u0441 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 RecyclerView.Adapter \u0442\u0438\u043f\u0430 MyMovieAdapter.MyViewHolder<\/p>\n<p>  \u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e onCreateViewHolder, getItemCount \u0438 onBindViewHolder. <br \/>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 MyViewHolder, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 itemView: View \u0438 \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f RecyclerView.ViewHolder \u0438 \u0432 \u0442\u0435\u043b\u043e \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  val image:ImageView = itemView.image_movie image_movie \u0443 \u043d\u0430\u0441 \u0442\u044f\u043d\u0435\u0442\u0441\u044f \u0438\u0437 item_layout<br \/>  \u0438 \u0442\u0430\u043a \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f view \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. <\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e bind c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c listItem: Movie, \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0438 view \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043b\u0438\u043a\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u044f \u0434\u0443\u043c\u0430\u044e \u0432\u044b \u0443\u043c\u0435\u0435\u0442\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0435\u043c getItemCount() \u0432 override fun getItemCount() = movieList.size. \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c movieList.size. \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 onBindViewHolder \u0438 onCreateViewHolder <\/p>\n<p>  <b>onCreateViewHolder<\/b> \u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 ViewHolder \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 RecyclerView \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u043c.<\/p>\n<p>  <b>onBindViewHolder<\/b> \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 ViewHolder \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u043e view \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435<\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439 c onCreateViewHolder \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f MyViewHolder. <br \/>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e itemView \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u0439 LayoutInflater.from(parent.context).inflate(R.layout.item_layout, parent, false) \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c MyViewHolder \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c itemView. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a onBindViewHolder \u0432 \u0442\u0435\u043b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e listItem: Movie \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c movieList[position]. \u0414\u0430\u043b\u0435\u0435 \u043a holder&#8217;y \u043c\u044b \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 bind \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 listItem. \u0414\u0430\u043b\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Picasso. <\/p>\n<p>  Picasso.get().load(movieList[position].imageurl).into(holder.image). \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c holder.txt_name.text = movieList[position].name, \u0438 \u0442\u0430\u043a \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0430\u0448\u0438\u043c\u0438 view \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"kotlin\"> import android.content.Context import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import android.widget.Toast import androidx.recyclerview.widget.RecyclerView import com.example.retrofitmarvel.Model.Movie import com.example.retrofitmarvel.R import com.squareup.picasso.Picasso import kotlinx.android.synthetic.main.item_layout.view.*  class MyMovieAdapter(private val context: Context,private val movieList: MutableList&lt;Movie&gt;):RecyclerView.Adapter&lt;MyMovieAdapter.MyViewHolder&gt;() {      class MyViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){         val image: ImageView = itemView.image_movie         val txt_name: TextView = itemView.txt_name         val txt_team: TextView = itemView.txt_team         val txt_createdby: TextView = itemView.txt_createdby          fun bind(listItem: Movie) {             image.setOnClickListener {                 Toast.makeText(it.context, &quot;\u043d\u0430\u0436\u0430\u043b \u043d\u0430 ${itemView.image_movie}&quot;, Toast.LENGTH_SHORT)                     .show()             }             itemView.setOnClickListener {                 Toast.makeText(it.context, &quot;\u043d\u0430\u0436\u0430\u043b \u043d\u0430 ${itemView.txt_name.text}&quot;, Toast.LENGTH_SHORT).show()             }         }     }      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {         val itemView = LayoutInflater.from(parent.context).inflate(R.layout.item_layout, parent, false)         return MyViewHolder(itemView)     }      override fun getItemCount() = movieList.size      override fun onBindViewHolder(holder: MyViewHolder, position: Int) {         val listItem = movieList[position]         holder.bind(listItem)          Picasso.get().load(movieList[position].imageurl).into(holder.image)         holder.txt_name.text = movieList[position].name         holder.txt_team.text = movieList[position].team         holder.txt_createdby.text = movieList[position].createdby     }  }  <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h4>8. MainActivity<\/h4>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 MainActivity \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0438 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0442\u0438\u043f\u0430 null \u043e\u0431\u044a\u044f\u0432\u0438\u043c \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 lateinit var mService: RetrofitServices, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0449\u0435 3 \u0442\u0430\u043a\u0438\u0445, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: LinearLayoutManager, MyMovieAdapter, AlertDialog. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0438\u0445 \u043a\u0430\u043a \u0445\u043e\u0442\u0438\u0442\u0435, \u044d\u0442\u043e \u0440\u043e\u043b\u0438 \u043d\u0435 \u0441\u044b\u0433\u0440\u0430\u0435\u0442. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 onCreate \u043c\u044b \u043a RetrofitServices \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c Common.retrofitServices. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 recyclerView \u043c\u044b \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c setHasFixedSize(true) \u2014 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u043f\u043e\u0441\u043b\u0435 \u043c\u044b \u043a \u043d\u0430\u0448\u0435\u043c\u0443 layoutManager \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c LinearLayoutManager(this).<\/p>\n<p>  <b>Layout Manager<\/b> \u2014 \u044d\u0442\u043e \u0432\u0435\u0449\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 View \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u0438\u0434\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a\u0436\u0435 \u043b\u0435\u0433\u043a\u043e \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c layoutManager \u0438 \u0443\u0436\u0435 \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c layoutManager. \u0425\u043e\u0440\u043e\u0448\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 SpotsDialog. \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u043d\u0435\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u0442\u0438\u043f\u043e\u043c AlertDialog \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c SpotsDialog \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 Builder \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 setCancelablec c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c true \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 setContext c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c this \u0438 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 build.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 onCreate \u043d\u0430\u0437\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 getAllMovieList. \u0412 \u0442\u0435\u043b\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0448 dialog \u0438 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434 show()<br \/>  \u0434\u0430\u043b\u0435\u0435 \u043a mService \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 getMovieList .enqueue(object: Callback&lt;MutableList&gt; { )<\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b, \u0443 \u043d\u0430\u0441 \u0438\u0445 \u0434\u0432\u0435 <b>onResponse<\/b> \u0438 <b>onFailure<\/b><br \/>  \u0438 \u0432 onResponse, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0435\u043b\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u044b \u043a adapter&#8217;y \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c <\/p>\n<pre><code class=\"kotlin\">MyMovieAdapter(baseContext, response.body() as MutableList&lt;Movie&gt;)<\/code><\/pre>\n<p>  \u0434\u0430\u043b\u0435\u0435 \u043a adapter&#8217;y \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 notifyDataSetChanged(). \u041a \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u043c\u044b \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c adapter \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c adapter. \u043f\u043e\u0441\u043b\u0435 \u043a dialog \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 dismiss(). \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0448 \u0434\u0438\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u044f\u0442\u0441\u044f.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"kotlin\"> import android.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.recyclerview.widget.LinearLayoutManager import com.example.retrofitmarvel.Adapter.MyMovieAdapter import com.example.retrofitmarvel.Common.Common import com.example.retrofitmarvel.Interface.RetrofitServices import com.example.retrofitmarvel.Model.Movie import com.example.retrofitmarvel.R  import dmax.dialog.SpotsDialog import kotlinx.android.synthetic.main.activity_main.* import retrofit2.Call import retrofit2.Callback import retrofit2.Response  class MainActivity : AppCompatActivity() {      lateinit var mService: RetrofitServices     lateinit var layoutManager: LinearLayoutManager     lateinit var adapter: MyMovieAdapter     lateinit var dialog: AlertDialog      override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContentView(R.layout.activity_main)          mService = Common.retrofitService         recyclerMovieList.setHasFixedSize(true)         layoutManager = LinearLayoutManager(this)         recyclerMovieList.layoutManager = layoutManager         dialog = SpotsDialog.Builder().setCancelable(true).setContext(this).build()          getAllMovieList()     }      private fun getAllMovieList() {         dialog.show()         mService.getMovieList().enqueue(object : Callback&lt;MutableList&lt;Movie&gt;&gt; {             override fun onFailure(call: Call&lt;MutableList&lt;Movie&gt;&gt;, t: Throwable) {              }              override fun onResponse(call: Call&lt;MutableList&lt;Movie&gt;&gt;, response: Response&lt;MutableList&lt;Movie&gt;&gt;) {                 adapter = MyMovieAdapter(baseContext, response.body() as MutableList&lt;Movie&gt;)                 adapter.notifyDataSetChanged()                 recyclerMovieList.adapter = adapter                  dialog.dismiss()             }         })     } } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Retrofit2 \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0435\u0433\u043e \u0432 RecyclerView.<\/div>\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:\/\/habr.com\/ru\/post\/520544\/\"> https:\/\/habr.com\/ru\/post\/520544\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/520544\/\">\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 <b>Retrofit<\/b> 2. \u041f\u0440\u0430\u0432\u0434\u044b \u0440\u0430\u0434\u0438 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0449\u0435 \u0441 2 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e <b>Picasso<\/b> \u0438 <b>Spots-dialog<\/b>.<\/p>\n<p>  \u042d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043a \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 Retrofit 2. \u0412\u0435\u0434\u044c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u043b\u0438.<\/p>\n<h4>0. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Android Studio, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Empty Activity. \u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0443 \u043d\u0430\u0441 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 Kotlin.<\/p>\n<h4>1. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/h4>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 build.gradle \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<pre><code class=\"java\">dependencies {     implementation 'com.squareup.retrofit2:retrofit:2.9.0'     implementation 'com.squareup.retrofit2:converter-gson:2.5.0'     implementation 'com.squareup.picasso:picasso:2.71828'      \/\/noinspection GradleCompatible     implementation 'com.android.support:design:28.0.0'     implementation 'com.github.d-max:spots-dialog:1.1@aar' }<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 Spots progress dialog. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0441\u044f \u0441 \u044d\u0442\u0438\u043c <a href=\"https:\/\/github.com\/dybarsky\/spots-dialog\">\u0437\u0434\u0435\u0441\u044c.<\/a> \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432 build.gradle(Modul:app) \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e:<\/p>\n<pre><code class=\"java\"> compileOptions {         sourceCompatibility JavaVersion.VERSION_1_8         targetCompatibility JavaVersion.VERSION_1_8     }<\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0437\u0430\u0439\u0442\u0438 \u0432 manifests \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430<\/p>\n<pre><code class=\"xml\">  &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;\/&gt;<\/code><\/pre>\n<p>  <\/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-310429","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/310429","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=310429"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/310429\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}