{"id":821,"date":"2025-07-26T07:45:06","date_gmt":"2025-07-26T07:45:06","guid":{"rendered":"https:\/\/nurlandroid.com\/?p=821"},"modified":"2025-07-26T07:45:07","modified_gmt":"2025-07-26T07:45:07","slug":"context-%d0%b2-android-%d0%b5-%d0%ba%d0%b0%d0%ba%d0%b8%d0%b5-%d0%b1%d1%8b%d0%b2%d0%b0%d1%8e%d1%82-%d1%87%d0%b5%d0%bc-%d0%be%d1%82%d0%bb%d0%b8%d1%87%d0%b0%d1%8e%d1%82%d1%81%d1%8f","status":"publish","type":"post","link":"https:\/\/nurlandroid.com\/?p=821","title":{"rendered":"Context \u0432 Android-\u0435. \u041a\u0430\u043a\u0438\u0435 \u0431\u044b\u0432\u0430\u044e\u0442, \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f?"},"content":{"rendered":"\n<p>\u041e\u0442\u0432\u0435\u0442: <code>Context<\/code> \u2014 \u044d\u0442\u043e <strong>\u043e\u0431\u044a\u0435\u043a\u0442-\u0441\u0440\u0435\u0434\u0430<\/strong>, \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:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c (<code>getString()<\/code>, <code>getDrawable()<\/code>)<\/li>\n\n\n\n<li>\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c (<code>getSystemService()<\/code>)<\/li>\n\n\n\n<li>\u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 (<code>getFilesDir()<\/code>)<\/li>\n\n\n\n<li>\u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 (<code>startActivity()<\/code>, <code>startService()<\/code>)<\/li>\n<\/ul>\n\n\n\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u2014 \u044d\u0442\u043e &#171;\u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430&#187; \u043a API Android, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u043a \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c\u0443 \u0446\u0438\u043a\u043b\u0443.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u0438\u0434\u044b <code><strong>Context<\/strong><\/code> \u0432 Android<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">\u0412\u0438\u0434<\/mark><\/th><th><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/mark><\/th><th><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">\u0413\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/mark><\/th><\/tr><\/thead><tbody><tr><td><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">ApplicationContext<\/mark><\/code><\/td><td>\u0416\u0438\u0432\u0451\u0442 \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/td><td>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430\u043c\u0438, \u0444\u043e\u043d\u043e\u0432\u044b\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438<\/td><\/tr><tr><td><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">Activity<\/mark><\/code><\/td><td>\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a Activity<\/td><td>UI-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, <code>startActivity()<\/code>, <code>Inflate<\/code><\/td><\/tr><tr><td><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">Service<\/mark><\/code><\/td><td>\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/td><td>\u0421\u043b\u0443\u0436\u0431\u044b \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b<\/td><\/tr><tr><td><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">BroadcastReceiver<\/mark><\/code><\/td><td>\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 <code>Context<\/code>, \u0436\u0438\u0432\u0451\u0442 \u0432\u043e \u0432\u0440\u0435\u043c\u044f <code>onReceive()<\/code><\/td><td>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d, \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c <code>Dialog<\/code><\/td><\/tr><tr><td><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">ContextWrapper<\/mark><\/code><\/td><td>\u041e\u0431\u0451\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u0434\u0440\u0443\u0433\u0438\u043c <code>Context<\/code><\/td><td>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f <code>ContextThemeWrapper<\/code>, <code>AppCompatActivity<\/code><\/td><\/tr><tr><td><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-primary-color\">ContextThemeWrapper<\/mark><\/code><\/td><td>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\/\u043c\u0435\u043d\u044f\u0435\u0442 \u0442\u0435\u043c\u0443<\/td><td>\u0412 <code>Dialog<\/code>, <code>Activity<\/code>, <code>AlertDialog.Builder<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><code>ApplicationContext<\/code>:<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u0416\u0438\u0432\u0451\u0442 \u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0436\u0438\u0432\u0451\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441<\/strong><\/li>\n\n\n\n<li>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u0435\u043d \u0434\u043b\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u043e\u0432, \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/li>\n\n\n\n<li><strong>\u041d\u0435\u043b\u044c\u0437\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f UI-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0442\u0435\u043c\u044b \u0438\u043b\u0438 <code>Window<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><code>Activity<\/code> context:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u041f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a <code>Activity<\/code>, \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a <strong>\u0442\u0435\u043c\u0435<\/strong>, <code>Window<\/code>, <code>LayoutInflater<\/code><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ff6900\" class=\"has-inline-color\">\u041c\u043e\u0436\u0435\u0442 \u0443\u0442\u0435\u0447\u044c<\/mark><\/strong>(!), \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0448\u044c \u0435\u0433\u043e \u0432 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u044b \u0438\u043b\u0438 <code>ViewModel<\/code><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u0442\u0432\u0435\u0442: Context \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442-\u0441\u0440\u0435\u0434\u0430, \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: \u041f\u043e \u0441\u0443\u0442\u0438 \u2014 \u044d\u0442\u043e &#171;\u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430&#187; \u043a API Android, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u043a \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c\u0443 \u0446\u0438\u043a\u043b\u0443. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u0438\u0434\u044b Context \u0432 Android \u0412\u0438\u0434 \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0413\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f ApplicationContext \u0416\u0438\u0432\u0451\u0442 \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430\u043c\u0438, \u0444\u043e\u043d\u043e\u0432\u044b\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 Activity \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a Activity UI-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, startActivity(), Inflate Service \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0421\u043b\u0443\u0436\u0431\u044b \u0438 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-821","post","type-post","status-publish","format-standard","hentry","category-android"],"_links":{"self":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=821"}],"version-history":[{"count":1,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/821\/revisions"}],"predecessor-version":[{"id":822,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/821\/revisions\/822"}],"wp:attachment":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}