{"id":165071,"date":"2013-01-08T17:02:03","date_gmt":"2013-01-08T13:02:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=165071"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=165071","title":{"rendered":"<span class=\"post_title\">\u041f\u0438\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Android \u043d\u0430 Ruby (Ruboto)<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0443 \u043c\u0435\u043d\u044f \u043a\u0430\u043a-\u0442\u043e \u0438\u0434\u0435\u044f(\u0438\u043b\u0438 \u0440\u0430\u0441c\u0447\u0451\u0442\u043a\u0430 \u043f\u043e \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u043c) \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 android \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043b\u044e\u0431\u0438\u043c\u043e\u043c ruby. \u0418 \u0442\u0443\u0442 \u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043f\u0440\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0441\u044f \u0432 <a href=\"http:\/\/rubynoname.ru\/\">RubyNoName<\/a> \u043f\u043e\u0434\u043a\u0430\u0441\u0442\u0435, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043e <a href=\"http:\/\/ruboto.org\/\">Ruboto<\/a>. <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/86b\/264\/f98\/86b264f98cbb0181882bea406006f0dc.png\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  \u041d\u0443 \u0447\u0442\u043e \u0436 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c. \u0414\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:  <\/p>\n<ol>\n<li>JDK<\/li>\n<li>Android SDK<\/li>\n<li>JRuby<\/li>\n<li>Gem Ruboto<\/li>\n<\/ol>\n<p>  \u0420\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u044f \u043d\u0435 \u0441\u0442\u0430\u043d\u0443, \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e <a href=\"https:\/\/github.com\/ruboto\/ruboto\/wiki\/Getting-started-with-Ruboto\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a> <br \/>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u0441\u0451 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.  <\/p>\n<pre><code class=\"ruby\">ruboto gen app --package ru.nitrodev.demo_app <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e <code>demo_app<\/code> \u0438 \u043b\u044e\u0431\u0443\u0435\u043c\u0441\u044f \u0437\u0430\u0431\u043e\u0442\u043b\u0438\u0432\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u043f\u0430\u043f\u043a\u0435 <code>src<\/code> \u0443\u0436\u0435 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430\u0448\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043d\u0435\u043c\u0443 \u043c\u044b \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c. <br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0443 \u0442\u0430\u043a\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u0435\u0449\u0438 \u043a\u0430\u043a:  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <\/li>\n<li>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0430\u0443\u0434\u0438\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e MediaPlayer<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438<\/li>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430<\/li>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 Intent (\u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0430\u0431\u043e\u0440 \u043d\u043e\u043c\u0435\u0440\u0430)<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0435\u043d\u044e<\/li>\n<\/ol>\n<p>\u041f\u043e\u0439\u0434\u0451\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/h4>\n<p>  \u0412 \u043b\u044e\u0431\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e XML \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u0442\u0435\u0440\u044f\u0435\u043c \u0432\u0441\u044e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c ruby. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u0434\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c Android API \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>ruboto\/widget.rb<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0432\u0451\u0440\u0442\u043a\u043e\u0439 \u043d\u0430\u0434 API \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 DSL \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. <br \/>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f LinearLayout \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u043e\u0434\u043d\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0438 4 \u043a\u043d\u043e\u043f\u043a\u0438.<br \/>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430  <\/p>\n<pre><code class=\"ruby\">java_import &quot;android.widget.Button&quot; java_import &quot;android.widget.TextView&quot; java_import &quot;android.widget.LinearLayout&quot; <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441   <\/p>\n<pre><code class=\"ruby\"> ll = LinearLayout.new(@ruboto_java_instance)   ll.orientation = LinearLayout::VERTICAL    tv = TextView.new(@ruboto_java_instance)   tv.text = &quot;\u041f\u0440\u043e\u0449\u0430\u0439 Java&quot;   ll.add_view tv #\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430\u0449\u0435 TextView \u0432 LinearLayout   params = tv.get_layout_params   params.width = ViewGroup::LayoutParams::MATCH_PARENT    btn1 = Button.new(@ruboto_java_instance)   btn1.text = &quot;Play&quot;   btn1.on_click_listener = proc{ Play }    ll.add_view btn1   params = search_b.get_layout_params   params.width = ViewGroup::LayoutParams::MATCH_PARENT    btn2 = Button.new(@ruboto_java_instance)   btn2.text = &quot;Pause&quot;   btn2.on_click_listener = proc{ Pause }    ll.add_view btn2   params = search_b.get_layout_params   params.width = ViewGroup::LayoutParams::MATCH_PARENT    btn3 = Button.new(@ruboto_java_instance)   btn3.text = &quot;\u0412\u0442\u043e\u0440\u043e\u0439 \u044d\u043a\u0440\u0430\u043d&quot;   btn3.on_click_listener = proc{ twoActivity }    ll.add_view btn3   params = search_b.get_layout_params   params.width = ViewGroup::LayoutParams::MATCH_PARENT    btn4 = Button.new(@ruboto_java_instance)   btn4.text = &quot;\u0422\u0440\u0435\u0442\u0438\u0439 \u044d\u043a\u0440\u0430\u043d&quot;   btn4.on_click_listener = proc{ threeActivity }    ll.add_view btn4   params = search_b.get_layout_params   params.width = ViewGroup::LayoutParams::MATCH_PARENT    setContentView ll <\/code><\/pre>\n<p>  \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u043c \u043a\u0430\u043a java \u0438 \u0432\u0440\u044f\u0434 \u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0432 ruby \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435. \u0411\u043e\u043b\u0435\u0435 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c DSL Ruboto. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043f\u0443\u0442\u044c Ruboto.<\/p>\n<pre><code class=\"ruby\">ruboto_import_widgets :Button, :LinearLayout, :TextView self.content_view =     linear_layout :orientation =&gt; :vertical do       text_view :text =&gt; '\u0422\u043e\u043b\u044c\u043a\u043e Ruby - \u0442\u043e\u043b\u044c\u043a\u043e \u0445\u0430\u0440\u0434\u043a\u043e\u0440', :width =&gt; :match_parent       button :text =&gt; 'Play', :width =&gt; :match_parent, :on_click_listener =&gt; proc { play }       button :text =&gt; 'Pause', :width =&gt; :match_parent, :on_click_listener =&gt; proc { pause }       button :text =&gt; '\u0412\u0442\u043e\u0440\u043e\u0439 \u044d\u0440\u0430\u043d', :width =&gt; :match_parent, :on_click_listener =&gt; proc { twoActivity }       button :text =&gt; '\u0422\u0440\u0435\u0442\u0438\u0439 \u044d\u0440\u0430\u043d', :width =&gt; :match_parent, :on_click_listener =&gt; proc { threeActivity }     end <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u043a\u043e\u043b\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c \u0432 4-5 \u0440\u0430\u0437. <br \/>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/29d\/ece\/6df\/29dece6dfed0f133ec0ef513d9551beb.png\"\/><\/p>\n<h4>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0430\u0443\u0434\u0438\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e MediaPlayer<\/h4>\n<p>  \u0414\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0437\u0432\u0443\u043a\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c MediaPlayer \u0438 AudioManager  <\/p>\n<pre><code class=\"ruby\">java_import &quot;android.media.MediaPlayer&quot; java_import &quot;android.media.AudioManager&quot; java_import &quot;android.net.Uri&quot;  <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c uri \u0444\u0430\u0439\u043b\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c MediaPlayer<\/p>\n<pre><code class=\"ruby\">java_file = java.io.File.new(&quot;\/mnt\/sdcard\/naive.mp3&quot;)     uri = Uri.fromFile(java_file)     @player = MediaPlayer.create(self, uri); <\/code><\/pre>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u043b\u0435\u0435\u0440\u043e\u043c \u043c\u043e\u0436\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438  <\/p>\n<pre><code class=\"ruby\">@player.start @player.pause <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438<\/h4>\n<p>  \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u043d\u0443\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438. <br \/>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f RubotoActivity \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>start_ruboto_activity<\/code>.<br \/>  <code>start_ruboto_activity<\/code> \u2014 \u044d\u0442\u043e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442 Android startActivity \u0432 Ruboto. \u041e\u043d \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440: \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u0443\u044e \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438 \u0438 \u0431\u043b\u043e\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438.<br \/>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438<\/p>\n<pre><code class=\"ruby\">start_ruboto_activity(&quot;$activity_two&quot;) do   def on_create(bundle)     super     setTitle '\u0412\u0442\u043e\u0440\u0430\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438'   end end <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430<\/h4>\n<p>  \u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 on_touch_event \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043e\u043c \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 onTouchEvent <br \/>  \u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u0441\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u0438\u043c \u043f\u0430\u043b\u044c\u0446\u0435\u043c  <\/p>\n<pre><code class=\"ruby\">def on_touch_event(event)     index = event.find_pointer_index(0)      x = event.getX(index)     y = event.getY(index)     toast &quot;Position: #{x}, #{y}&quot;   true end <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 Intent<\/h4>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Intent \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 Android API  <\/p>\n<pre><code class=\"ruby\">java_import &quot;android.content.Intent&quot; <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 Intent \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e java<\/p>\n<pre><code class=\"ruby\">intent = Intent.new(Intent::ACTION_CALL)           intent.setData(Uri.parse(&quot;tel:5551234&quot;))           startActivity(intent)  intent = Intent.new(Intent::ACTION_VIEW)           intent.setData(Uri.parse(&quot;http:\/\/ruboto.org\/&quot;))           startActivity(intent) <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 AndroidManifest   <\/p>\n<pre><code class=\"ruby\">&lt;uses-permission android:name=&quot;android.permission.CALL_PHONE&quot; \/&gt; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0435\u043d\u044e<\/h4>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0435\u043d\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u043b\u043b\u0431\u0435\u043a <code>on_create_options_menu<\/code>. \u0422\u0443\u0442 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0443\u043d\u043a\u0442\u044b \u043c\u0435\u043d\u044e \u0438 \u0432\u0435\u0448\u0430\u0435\u043c \u043d\u0430 \u043d\u0438\u0445 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f, \u043f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435 \u0432 <code>toast<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u0430 \u043c\u0435\u043d\u044e.   <\/p>\n<pre><code class=\"ruby\">def on_create_options_menu(menu)   m1 = menu.add('Action 1')   m1.set_on_menu_item_click_listener do |menu_item|     @text_view.text = menu_item_title     toast menu_item.title     true    end    m2 = menu.add('Action 2')   m2.set_on_menu_item_click_listener do |menu_item|     @text_view.text = menu_item.title     toast menu_item.title     true    end   true end <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0432\u0441\u0451.<br \/>  \u0412\u0435\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/Nitrino\/ruboto_audio\">github<\/a><br \/>  \u0421\u0441\u044b\u043b\u043a\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432 Ruboto:<br \/>  Wiki: <a href=\"https:\/\/github.com\/ruboto\/ruboto\/wiki\">github.com\/ruboto\/ruboto\/wiki<\/a><br \/>  Readme: <a href=\"https:\/\/github.com\/ruboto\/ruboto\/blob\/master\/README.md\">github.com\/ruboto\/ruboto\/blob\/master\/README.md<\/a><br \/>  \u041e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438: <a href=\"http:\/\/jay.mcgavren.com\/files\/presentations\/ruboto\/\">jay.mcgavren.com\/files\/presentations\/ruboto\/<\/a> \t\t\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\/165071\/\"> http:\/\/habrahabr.ru\/post\/165071\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0443 \u043c\u0435\u043d\u044f \u043a\u0430\u043a-\u0442\u043e \u0438\u0434\u0435\u044f(\u0438\u043b\u0438 \u0440\u0430\u0441c\u0447\u0451\u0442\u043a\u0430 \u043f\u043e \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u043c) \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 android \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043b\u044e\u0431\u0438\u043c\u043e\u043c ruby. \u0418 \u0442\u0443\u0442 \u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043f\u0440\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0441\u044f \u0432 <a href=\"http:\/\/rubynoname.ru\/\">RubyNoName<\/a> \u043f\u043e\u0434\u043a\u0430\u0441\u0442\u0435, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043e <a href=\"http:\/\/ruboto.org\/\">Ruboto<\/a>. <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/86b\/264\/f98\/86b264f98cbb0181882bea406006f0dc.png\"\/>  <\/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-165071","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/165071","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=165071"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/165071\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}