{"id":166335,"date":"2013-01-20T12:39:04","date_gmt":"2013-01-20T08:39:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=166335"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=166335","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0435\u043a\u0442 \u2014 \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 Android \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0441\u0442\u0430\u043b\u0438 \u0432\u0441\u0435 \u0447\u0430\u0449\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0434\u043b\u044f Android. \u0414\u0430\u0431\u044b \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0438 \u0432\u043d\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u043e\u0434\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u043c\u0443 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044e Android \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435-\u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0443 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u044f\u0434\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 Android SDK. \u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043e \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a: Activity, Service, Intent, Broadcast Receiver.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438 \u043a\u0430\u043a:  <\/p>\n<ul>\n<li>Activity<\/li>\n<li>Service<\/li>\n<li>Broadcast Receiver<\/li>\n<li>SQLite<\/li>\n<li>Asynk Tasks<\/li>\n<li>XML parsing<\/li>\n<li>ActionBar Sherlock<\/li>\n<\/ul>\n<p>  \u0418 \u0442\u0430\u043a, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043c \u0442\u0430\u043a\u043e\u0435: \u00ab\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0435 \u043f\u043e\u0433\u043e\u0434\u0443 \u0432 \u041c\u043e\u0441\u043a\u0432\u0435, \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Yahoo\u00bb.<br \/>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431 \u043e\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 Android SDK \u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0439\u0442\u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u043c \u0438 \u0441 \u0442\u043e\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435 \u0441\u0430\u043c\u044b\u043c \u0432\u0435\u0440\u043d\u044b\u043c \u043f\u0443\u0442\u0435\u043c.<br \/>  \u0412 \u043d\u0430\u0447\u0430\u043b\u0435, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e\u0431\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e Activity, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. <\/li>\n<li>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c Service. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0437 \u0441\u0435\u0442\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435.<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u043a\u0438\u0440\u043f\u0438\u0447\u0438\u043a\u043e\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c Broadcast Receiver \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u043a\u0440\u0443\u043f\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f.<\/li>\n<\/ul>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430\u0448\u0435\u0439 Activity. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0432 \u043f\u0430\u043f\u043a\u0435 \/src \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0444\u0430\u0439\u043b MainActivity.java.<br \/>  \u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Action Bar \u0432 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0447\u0435\u043c API 11 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Action Bar Sherlock, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 Activity \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 SherlockActivity \u0442\u0430\u043a\u0438\u043c \u0432\u043e\u0442 \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"java\">public class MainActivity extends SherlockActivity {  } <\/code><\/pre>\n<p>  v\u0415\u0441\u043b\u0438 \u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 ActionBarSherlock \u2013 \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u0430\u0439\u0442\u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443<a href=\"http:\/\/actionbarsherlock.com\/\"> http:\/\/actionbarsherlock.com\/<\/a>. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0435\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u2013 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0443 \u0432\u0430\u0441 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>  \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 Activity \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432 \u043d\u0435\u0439 \u043c\u0435\u0442\u043e\u0434 <br \/>  <b>onCreate(Bundle savedInstanceState)<\/b>. \u0417\u0430 \u0432\u0441\u044e \u0441\u0432\u043e\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u0434 Android, \u044f \u0432\u0441\u0435\u0433\u043e 1 \u0440\u0430\u0437 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0435\u0439, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<pre><code class=\"java\">@Override     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setTheme(R.style.Theme_Sherlock);         setContentView(R.layout.main);     } <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 3\u0445 \u0441\u0442\u0440\u043e\u0435\u043a: \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0441\u0443\u043f\u0435\u0440\u043a\u043b\u0430\u0441\u0441\u0430, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0435\u043c\u044b \u0434\u043b\u044f Activity \u2013 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b Action Bar \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 layout \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 Activity.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448 Action Bar \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0435\u0449\u0435 2 \u043c\u0435\u0442\u043e\u0434\u0430. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0448\u0443 Activity:<\/p>\n<pre><code class=\"java\">public final static String NEW_WEATHER_EVENT = &quot;com.andrewkravets.weather.NEW_WEATHER_ADDED&quot;;     private final static String REFRESH_MENU_ITEM = &quot;Refresh&quot;;     private UpdateService mService;     private boolean mBound; \u0418 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u044b:     @Override     public boolean onCreateOptionsMenu(Menu menu) {         menu.add(REFRESH_MENU_ITEM).setIcon(android.R.drawable.ic_dialog_info)                 .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);         return true;     }      @Override     public boolean onMenuItemSelected(int featureId, MenuItem item) {         if (item.getTitle().equals(REFRESH_MENU_ITEM)) {             if (mBound) {                 mService.loadWeatherData();             }             return true;         }         return false;     } <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 Activity \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e Service. \u041f\u0443\u0441\u0442\u044c \u0432\u0430\u0441 \u043d\u0435 \u0441\u043c\u0443\u0449\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u044f \u0432\u044b\u0437\u044b\u0432\u0430\u044e \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043c\u0435\u0442\u043e\u0434, \u0438\u043b\u0438 \u0432\u0432\u0435\u043b \u043a\u0443\u0447\u0443 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043c\u044b \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u0435\u0439\u0447\u0430\u0441 \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c.<br \/>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0445 \u0432\u0441\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<pre><code class=\"java\">public interface Consts {     public static final String API_URL = &quot;http:\/\/weather.yahooapis.com\/forecastrss?w=2122265&u=c&quot;;     public static final String ROOT = &quot;yweather:condition&quot;;     public static final String CONDITION_TEXT = &quot;text&quot;;     public static final String CONDITION_TEMP = &quot;temp&quot;;     public static final String CONDITION_DATE = &quot;date&quot;; } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 UpdateService \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d \u043e\u0442 Service.<\/p>\n<pre><code class=\"java\">public class UpdateService extends Service implements Consts {  } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e \u043f\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"java\">private final IBinder mBinder = new LocalBinder();     private boolean mIsLoading;      @Override     public IBinder onBind(Intent intent) {         return mBinder;     }      public class LocalBinder extends Binder {         public UpdateService getService() {             return UpdateService.this;         }     } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <b>mIsLoading <\/b>\u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430, \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<br \/>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c AsynkTask \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0435\u0435 \u0438 \u0437\u0430\u043d\u043e\u0441\u0438\u0442\u044c \u0432 \u0431\u0430\u0437\u0443.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0434\u0435\u043b\u044c, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 POJO \u043a\u043b\u0430\u0441\u0441, WeatherObject, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0440\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044f: \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0438 \u0434\u0430\u0442\u0443. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 IDE \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0438 get- \u0438 set- \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<pre><code class=\"java\">private class ManageWeatherData extends AsyncTask&lt;Void, Void, Void&gt; {         @Override         protected void onPreExecute() {             super.onPreExecute();             mIsLoading = true;         }          @Override         protected Void doInBackground(Void... params) {             getWeather();             return null;         }          @Override         protected void onPostExecute(Void aVoid) {             super.onPostExecute(aVoid);             Intent intent = new Intent(MainActivity.NEW_WEATHER_EVENT);             sendBroadcast(intent);             mIsLoading = false;         }     }      private void getWeather() {         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();         try {             DocumentBuilder db = dbf.newDocumentBuilder();             Document dom = db.parse(API_URL);             parseDocument(dom);         } catch (ParserConfigurationException pce) {             pce.printStackTrace();         } catch (SAXException se) {             se.printStackTrace();         } catch (IOException ioe) {             ioe.printStackTrace();         }     }      private void parseDocument(Document dom) {         Element docEle = dom.getDocumentElement();          NodeList nl = docEle.getElementsByTagName(ROOT);         if (nl != null && nl.getLength() &gt; 0) {             for (int i = 0; i &lt; nl.getLength(); i++) {                 Element el = (Element) nl.item(i);                 WeatherObject weatherObject = parseWeather(el);                 writeToDB(weatherObject);             }         }     }      private WeatherObject parseWeather(Element el) {         String condition = el.getAttribute(CONDITION_TEXT);         String temp = el.getAttribute(CONDITION_TEMP);         String date = el.getAttribute(CONDITION_DATE);         return new WeatherObject(condition, temp, date);     }      private void writeToDB(WeatherObject weatherObject) {         DatabaseHandler.getInstance(getApplicationContext()).addWeather(weatherObject);     } \u0414\u043b\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043d\u0430\u0448\u0435\u0433\u043e Service \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u043c\u0443 \u043e\u0442\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430\u0447\u0430\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443.     public void loadWeatherData() {         if (!mIsLoading) {             new ManageWeatherData().execute();         }     } <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448 Service \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d \u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  \u041d\u0438\u0436\u0435 \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043a\u043b\u0430\u0441\u0441\u0430, \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438 \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"java\">public class DatabaseHandler extends SQLiteOpenHelper {      private static final int DATABASE_VERSION = 1;     private static final String DATABASE_NAME = &quot;weather&quot;;     private static final String TABLE_CURRENT_WEATHER = &quot;currentWeather&quot;;     private static final String KEY_ID = &quot;id&quot;;     private static final String KEY_CONDITION = &quot;condition&quot;;     private static final String KEY_TEMP = &quot;temperature&quot;;     private static final String KEY_DATE = &quot;date&quot;;     private static final String KEY_SIZE = &quot;count(*)&quot;;      private static final String SIZE_QUERY = &quot;SELECT &quot;+ KEY_SIZE +&quot; FROM &quot; + TABLE_CURRENT_WEATHER;     private static final String SELECT_QUERY = &quot;SELECT * FROM &quot; + TABLE_CURRENT_WEATHER;     private static final String DROP_QUERY = &quot;DROP TABLE IF EXISTS &quot; + TABLE_CURRENT_WEATHER;     private static final String CREATE_WEATHER_TABLE_QUERY = &quot;CREATE TABLE &quot; + TABLE_CURRENT_WEATHER + &quot;(&quot;             + KEY_ID + &quot; INTEGER PRIMARY KEY,&quot; + KEY_CONDITION + &quot; TEXT,&quot; + KEY_TEMP + &quot; TEXT,&quot; + KEY_DATE + &quot; TEXT&quot; + &quot;)&quot;;      private static DatabaseHandler mInstance = null;      \/\/\u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0432 \u0432\u0438\u0434\u0435 Singleton \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e     private DatabaseHandler(Context context) {         super(context, DATABASE_NAME, null, DATABASE_VERSION);     }      public static DatabaseHandler getInstance(Context context) {         if (mInstance == null) {             synchronized (DatabaseHandler.class) {                 if (mInstance == null) {                     mInstance = new DatabaseHandler(context);                 }             }         }         return mInstance;     }      @Override     public void onCreate(SQLiteDatabase db) {         db.execSQL(CREATE_WEATHER_TABLE_QUERY);     }      @Override     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {         db.execSQL(DROP_QUERY);         onCreate(db);     }      \/\/\u041c\u0435\u0442\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0431\u0430\u0437\u0443     public void addWeather(WeatherObject object) {         SQLiteDatabase db = mInstance.getWritableDatabase();          ContentValues values = new ContentValues();         values.put(KEY_CONDITION, object.getCondition());         values.put(KEY_TEMP, object.getTemp());         values.put(KEY_DATE, object.getDate());          \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0431\u0430\u0437\u0435, \u0435\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442 - \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0435.         if (getDBSize() == 0) {             db.insert(TABLE_CURRENT_WEATHER, null, values);         } else {             db.update(TABLE_CURRENT_WEATHER, values, KEY_ID + &quot;=1&quot;, null);         }         db.close();     }      \/\/\u041e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435     private int getDBSize() {         SQLiteDatabase db = mInstance.getReadableDatabase();         Cursor cursor = db.rawQuery(SIZE_QUERY, null);          if (cursor.moveToFirst()) {             return Integer.parseInt(cursor.getString(cursor.getColumnIndex(KEY_SIZE)));         }         cursor.close();         return 0;     }      \/\/\u041c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u0431\u0430\u0437\u044b     public WeatherObject getWeather() {         WeatherObject weatherObject = null;         SQLiteDatabase db = this.getReadableDatabase();         Cursor cursor = db.rawQuery(SELECT_QUERY, null);          if (cursor.moveToFirst()) {             int condition = cursor.getColumnIndex(KEY_CONDITION);             int temp = cursor.getColumnIndex(KEY_TEMP);             int date = cursor.getColumnIndex(KEY_DATE);             weatherObject = new WeatherObject(cursor.getString(condition), cursor.getString(temp), cursor.getString(date));         }         cursor.close();         return weatherObject;     } } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Android, \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 Cursor \u043f\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c. <br \/>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0432\u044b\u0448\u043b\u0438 \u043d\u0430 \u0444\u0438\u043d\u0438\u0448\u043d\u0443\u044e \u043f\u0440\u044f\u043c\u0443\u044e, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c AndroidManifest.xml<br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u0431\u0440\u043e\u0441\u043a\u0430 \u043c\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;RelativeLayout         xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;               android:orientation=&quot;vertical&quot;               android:layout_marginLeft=&quot;10dp&quot;               android:layout_marginTop=&quot;10dp&quot;               android:layout_width=&quot;fill_parent&quot;               android:layout_height=&quot;fill_parent&quot;&gt;     &lt;TextView             android:id=&quot;@+id\/main_date_label&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:text=&quot;@string\/date&quot;\/&gt;     &lt;TextView             android:id=&quot;@+id\/main_date_value&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_toRightOf=&quot;@+id\/main_date_label&quot;             android:layout_alignLeft=&quot;@+id\/main_temperature_value&quot;\/&gt;     &lt;TextView             android:id=&quot;@+id\/main_temperature_label&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_below=&quot;@+id\/main_date_label&quot;             android:text=&quot;@string\/temperature&quot;\/&gt;     &lt;TextView             android:id=&quot;@+id\/main_temperature_value&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_marginLeft=&quot;10dp&quot;             android:layout_below=&quot;@+id\/main_date_label&quot;             android:layout_toRightOf=&quot;@+id\/main_temperature_label&quot;\/&gt;     &lt;TextView             android:id=&quot;@+id\/main_condition_label&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_below=&quot;@+id\/main_temperature_label&quot;             android:text=&quot;@string\/condition&quot;\/&gt;     &lt;TextView             android:id=&quot;@+id\/main_condition_value&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_below=&quot;@+id\/main_temperature_label&quot;             android:layout_toRightOf=&quot;@+id\/main_condition_label&quot;             android:layout_alignLeft=&quot;@+id\/main_temperature_value&quot;\/&gt; &lt;\/RelativeLayout&gt;  <\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u0434\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043d\u0430\u0434\u043f\u0438\u0441\u0435\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u044e\u0447\u0430 @string \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0444\u0430\u0439\u043b strings.xml \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u0447\u0435\u043a:<\/p>\n<pre><code class=\"xml\">    &lt;string name=&quot;temperature&quot;&gt;Temperature:&lt;\/string&gt;     &lt;string name=&quot;date&quot;&gt;Date:&lt;\/string&gt;     &lt;string name=&quot;condition&quot;&gt;Condition:&lt;\/string&gt; <\/code><\/pre>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 Activity \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u0439 Broadcast Receiver \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. <\/p>\n<pre><code class=\"java\">private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {         @Override         public void onReceive(Context context, Intent intent) {             new UpdateUI().execute();         }     };      private class UpdateUI extends AsyncTask&lt;Void, Void, WeatherObject&gt; {          @Override         protected WeatherObject doInBackground(Void... params) {             return DatabaseHandler.getInstance(MainActivity.this).getWeather();         }          @Override         protected void onPostExecute(WeatherObject object) {             super.onPostExecute(object);             if (object != null) {                 ((TextView) findViewById(R.id.main_date_value)).setText(object.getDate());                 ((TextView) findViewById(R.id.main_temperature_value)).setText(object.getTemp());                 ((TextView) findViewById(R.id.main_condition_value)).setText(object.getCondition());             }         }     } <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d AsynkTask \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0431\u0430\u0437\u044b \u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<br \/>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0442\u0440\u0438\u0445\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u043d\u0435\u0441\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0432 \u0432 \u043d\u0430\u0448 Android Manifest, \u0437\u0430\u0434\u0435\u043a\u043b\u0430\u0440\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n<pre><code class=\"xml\">    &lt;service android:enabled=&quot;true&quot; android:name=&quot;.tools.UpdateService&quot;\/&gt; <\/code><\/pre>\n<p>  \u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0441\u0435\u0442\u044c\u044e \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442:<\/p>\n<pre><code class=\"xml\">    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;\/&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u0432\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0438 \u043d\u0430\u0439\u0442\u0438 \u043a\u0443\u0441\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435.<br \/>  \u0412\u0435\u0440\u0441\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043f\u0438\u0441\u0430\u043b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/bitbucket.org\/akravets\/yahoo-weather-example\">Bitbucket<\/a><br \/>  <b>P.S.<\/b><br \/>  \u0411\u0443\u0434\u0443 \u0440\u0430\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0435, \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/166335\/\"> http:\/\/habrahabr.ru\/post\/166335\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0441\u0442\u0430\u043b\u0438 \u0432\u0441\u0435 \u0447\u0430\u0449\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0434\u043b\u044f Android. \u0414\u0430\u0431\u044b \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0438 \u0432\u043d\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u043e\u0434\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u043c\u0443 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044e Android \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435-\u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0443 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u044f\u0434\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 Android SDK. \u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043e \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a: Activity, Service, Intent, Broadcast Receiver.  <\/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-166335","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/166335","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=166335"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/166335\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=166335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=166335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=166335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}