{"id":188860,"date":"2013-08-03T12:25:03","date_gmt":"2013-08-03T08:25:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=188860"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=188860","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Volley<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       \u042f \u0443\u0432\u0435\u0440\u0435\u043d \u0432\u044b, \u0435\u0449\u0435 \u043d\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u0441\u043b\u043e\u0432\u043e \u00abVolley\u00bb, \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043d\u0430 Google I\/O 2013 <a href=\"https:\/\/plus.google.com\/+FicusKirkpatrick\">Ficus Kirkpatrick<\/a>.<\/p>\n<h4>\u0414\u043b\u044f \u0447\u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Volley?<\/h4>\n<p>  <\/p>\n<blockquote><p>Volley \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f Android \u043f\u0440\u043e\u0449\u0435 \u0438, \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p><\/blockquote>\n<p>  \u041e\u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0438 \u044d\u0442\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0434\u0440\u0430\u0433\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u043e\u0434\u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\/\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438\u0437 \u043a\u044d\u0448\u0430 \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430. \u0418 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e, \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a \ud83d\ude42<a name=\"habracut\"><\/a><\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 AsyncTask, \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 Web API \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432 View. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 ProgressBar\/ProgressDialog \u0432\u043d\u0443\u0442\u0440\u0438 OnsourceExecute() \u0438 OnPostExecute(). \u042f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0440\u0443\u0434\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0440\u0443\u0442\u0438\u043d\u043d\u0430\u044f. \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u0441\u043a\u0443\u0447\u043d\u043e, \u0434\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f ProgressBar\/ProgressDialog \u0438 \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, Volley \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0439 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439 AsyncTask.<\/p>\n<h4>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Volley:<\/h4>\n<p>  <\/p>\n<ol>\n<li>Volley \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. Volley \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0430 \u0441\u0435\u0431\u044f \u0432\u0441\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438\u0445 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0438\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u043e\u0432.<\/li>\n<li>Volley \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<\/li>\n<li>Volley \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043c\u043e\u0449\u043d\u043e\u0435 API \u0434\u043b\u044f \u043e\u0442\u043c\u0435\u043d\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u043b\u044f \u043e\u0442\u043c\u0435\u043d\u044b.<\/li>\n<li>Volley \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043e\u0449\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/li>\n<li>Volley \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<h4>\u041a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c?<\/h4>\n<p>  <\/p>\n<ol>\n<li>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 Volley.<br \/> \n<pre><code class=\"bash\">git clone https:\/\/android.googlesource.com\/platform\/frameworks\/volley <\/code><\/pre>\n<\/li>\n<li><a href=\"http:\/\/developer.android.com\/tools\/projects\/projects-eclipse.html#ReferencingLibraryProject\">\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043a\u043e\u0434 \u0432 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442<\/a>.<\/li>\n<\/ol>\n<p>  <\/p>\n<h4>2 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430 Volley<\/h4>\n<p>  \u0415\u0441\u0442\u044c 2 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430:  <\/p>\n<ol>\n<li>Request queue<\/li>\n<li>Request<\/li>\n<\/ol>\n<p>  <b>Request queue:<\/b> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 request queue, \u0433\u0434\u0435 \u0445\u043e\u0442\u0438\u0442\u0435, \u043d\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u0430\u043a Singleton.<\/p>\n<p>  <b>Request:<\/b> \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 Web API. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043a\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (GET \u0438\u043b\u0438 POST), \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, response listener, error listener.<\/p>\n<p>  \u0412\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 JSONObjectRequest:  <\/p>\n<pre><code>    \/**      * Creates a new request.      * @param method the HTTP method to use      * @param url URL to fetch the JSON from      * @param jsonRequest A {@link JSONObject} to post with the request. Null is allowed and      *   indicates no parameters will be posted along with request.      * @param listener Listener to receive the JSON response      * @param errorListener Error listener, or null to ignore errors.      *\/     public JsonObjectRequest(int method, String url, JSONObject jsonRequest,             Listener&lt;JSONObject&gt; listener, ErrorListener errorListener) {         super(method, url, (jsonRequest == null) ? null : jsonRequest.toString(), listener,                     errorListener);     }      \/**      * Constructor which defaults to &lt;code&gt;GET&lt;\/code&gt; if &lt;code&gt;jsonRequest&lt;\/code&gt; is      * &lt;code&gt;null&lt;\/code&gt;, &lt;code&gt;POST&lt;\/code&gt; otherwise.      *      * @see #JsonObjectRequest(int, String, JSONObject, Listener, ErrorListener)      *\/     public JsonObjectRequest(String url, JSONObject jsonRequest, Listener&lt;JSONObject&gt; listener,             ErrorListener errorListener) {         this(jsonRequest == null ? Method.GET : Method.POST, url, jsonRequest,                 listener, errorListener);     }<\/code><\/pre>\n<p>  <\/p>\n<h4>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Volley:<\/h4>\n<p>  \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0432\u044b \u0443\u0436\u0435 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u0438\/\u0441\u043a\u0430\u0447\u0430\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Volley \u0438\u0437 Git \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c, \u0447\u0442\u043e \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f JSON \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<p>  <b>\u0428\u0430\u0433 1:<\/b> \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c \u0447\u0442\u043e \u0432\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 Volley \u0432 Eclipse. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 (Library project), \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u0438 =&gt; Properties =&gt; Android (\u043b\u0435\u0432\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c).<\/p>\n<p>  <a href=\"http:\/\/habr.habrastorage.org\/post_images\/c30\/34a\/835\/c3034a8353cdfc86f47379b6a24a7e24.png\"><img decoding=\"async\" alt=\"volley as a library project\" src=\"http:\/\/habr.habrastorage.org\/post_images\/c30\/34a\/835\/c3034a8353cdfc86f47379b6a24a7e24.png\"\/><\/a><\/p>\n<p>  <b>\u0428\u0430\u0433 2:<\/b> \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <b>VolleyExample<\/b>.<\/p>\n<p>  <b>\u0428\u0430\u0433 3:<\/b> \u041f\u0440\u0430\u0432\u044b\u0439 \u043a\u043b\u0438\u043a \u043d\u0430 VolleyExample \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Volley \u0432 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  <a href=\"http:\/\/habr.habrastorage.org\/post_images\/f25\/c3c\/1ee\/f25c3c1ee5dc638b4f9b5022d3f4c3f1.png\"><img decoding=\"async\" alt=\"Including volley library in Android project\" src=\"http:\/\/habr.habrastorage.org\/post_images\/f25\/c3c\/1ee\/f25c3c1ee5dc638b4f9b5022d3f4c3f1.png\"\/><\/a><\/p>\n<p>  <b>\u0428\u0430\u0433 4:<\/b> \u0412\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \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 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 AndroidManifest.xml<\/p>\n<pre><code class=\"xml\">&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;\/&gt;<\/code><\/pre>\n<p>  <b>\u0428\u0430\u0433 5:<\/b><br \/>  5.1 \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 RequestQueue<\/p>\n<pre><code>RequestQueue queue = Volley.newRequestQueue(this);<\/code><\/pre>\n<p>  5.2 \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 JSONObjectRequest \u0441 response \u0438 error listener.<\/p>\n<pre><code>String url = &quot;https:\/\/www.googleapis.com\/customsearch\/v1?key=AIzaSyBmSXUzVZBKQv9FJkTpZXn0dObKgEQOIFU&cx=014099860786446192319:t5mr0xnusiy&q=AndroidDev&alt=json&searchType=image&quot;;  JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;() {    @Override   public void onResponse(JSONObject response) {    \/\/ TODO Auto-generated method stub    txtDisplay.setText(&quot;Response =&gt; &quot;+response.toString());    findViewById(R.id.progressBar1).setVisibility(View.GONE);   }  }, new Response.ErrorListener() {    @Override   public void onErrorResponse(VolleyError error) {   \/\/ TODO Auto-generated method stub    }  });<\/code><\/pre>\n<p>  5.3 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432\u0430\u0448 request \u0432 RequestQueue.  <\/p>\n<pre><code class=\"java\">queue.add(jsObjRequest);<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0444\u0430\u0439\u043b\u0430 MainActivity.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package com.technotalkative.volleyexamplesimple;  import org.json.JSONObject;  import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.TextView;  import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.Volley;  public class MainActivity extends Activity {   private TextView txtDisplay;   @Override  protected void onCreate(Bundle savedInstanceState) {   super.onCreate(savedInstanceState);   setContentView(R.layout.activity_main);    txtDisplay = (TextView) findViewById(R.id.txtDisplay);    RequestQueue queue = Volley.newRequestQueue(this);   String url = &quot;https:\/\/www.googleapis.com\/customsearch\/v1?key=AIzaSyBmSXUzVZBKQv9FJkTpZXn0dObKgEQOIFU&cx=014099860786446192319:t5mr0xnusiy&q=AndroidDev&alt=json&searchType=image&quot;;    JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;() {     @Override    public void onResponse(JSONObject response) {     \/\/ TODO Auto-generated method stub     txtDisplay.setText(&quot;Response =&gt; &quot;+response.toString());     findViewById(R.id.progressBar1).setVisibility(View.GONE);    }   }, new Response.ErrorListener() {     @Override    public void onErrorResponse(VolleyError error) {     \/\/ TODO Auto-generated method stub     }   });    queue.add(jsObjRequest);   }   @Override  public boolean onCreateOptionsMenu(Menu menu) {   \/\/ Inflate the menu; this adds items to the action bar if it is sourcesent.   getMenuInflater().inflate(R.menu.main, menu);   return true;  }  }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Volley: <a href=\"https:\/\/github.com\/PareshMayani\/Android-Volley-Example\">https:\/\/github.com\/PareshMayani\/Android-Volley-Example<\/a><\/li>\n<li>\u0412\u0438\u0434\u0435\u043e \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044f: <a href=\"http:\/\/www.youtube.com\/watch?v=yhv8l9F44qo\">Google I\/O 2013 \u2013 Volley: Easy, Fast Networking for Android<\/a><\/li>\n<\/ul>\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\/188860\/\"> http:\/\/habrahabr.ru\/post\/188860\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       \u042f \u0443\u0432\u0435\u0440\u0435\u043d \u0432\u044b, \u0435\u0449\u0435 \u043d\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u0441\u043b\u043e\u0432\u043e \u00abVolley\u00bb, \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043d\u0430 Google I\/O 2013 <a href=\"https:\/\/plus.google.com\/+FicusKirkpatrick\">Ficus Kirkpatrick<\/a>.<\/p>\n<h4>\u0414\u043b\u044f \u0447\u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Volley?<\/h4>\n<p>  <\/p>\n<blockquote><p>Volley \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f Android \u043f\u0440\u043e\u0449\u0435 \u0438, \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p><\/blockquote>\n<p>  \u041e\u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0438 \u044d\u0442\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0434\u0440\u0430\u0433\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u043e\u0434\u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\/\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438\u0437 \u043a\u044d\u0448\u0430 \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430. \u0418 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e, \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a \ud83d\ude42<\/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-188860","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/188860","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=188860"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/188860\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=188860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=188860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=188860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}