{"id":227549,"date":"2014-06-25T14:06:04","date_gmt":"2014-06-25T10:06:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=227549"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=227549","title":{"rendered":"<span class=\"post_title\">\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u043c\u0435\u043d\u044e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 ExpandableListView<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u043d\u0430\u044e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<b> Lucky Patcher<\/b>, \u0432 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0434\u0435\u043b\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e: \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u0435\u0441\u0442\u044c \u043c\u0435\u043d\u044e. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/059\/f6a\/2d5\/059f6a2d588037e5427ca80065303b4a.png\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0440\u0443\u0437\u0435\u0439 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 <a href=\"http:\/\/habrahabr.ru\/post\/147546\/\"><i>\u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e<\/i><\/a>, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439: <\/p>\n<blockquote>\n<pre><code class=\"java\">private ArrayList&lt;ArrayList&lt;String&gt;&gt; mGroups;<\/code><\/pre>\n<\/blockquote>\n<p>  \u0410 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c \u0432 <a href=\"http:\/\/androidexample.com\/Custom_Expandable_ListView_Tutorial_-_Android_Example\/index.php?view=article_discription&amp;aid=107&amp;aaid=129\">\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445<\/a>, \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u0432\u043e\u0442 \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c: <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/fc5\/6ef\/8f4\/fc56ef8f4a224a0968f90cfa17f4cd37.png\"\/><\/p>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c ListActivity, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <b>ActionBarActivity<\/b> (\u043c\u043e\u0436\u043d\u043e \u0438 \u043e\u0442 <b>Activity<\/b>). \u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 (<b>activity_list.xml<\/b>):<\/p>\n<pre><code class=\"xml\">&lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;     android:id=&quot;@+id\/activity_list&quot;     android:layout_width=&quot;match_parent&quot;     android:layout_height=&quot;match_parent&quot;     android:orientation=&quot;vertical&quot;     android:paddingLeft=&quot;@dimen\/activity_horizontal_margin&quot;     android:paddingRight=&quot;@dimen\/activity_horizontal_margin&quot;     android:paddingTop=&quot;@dimen\/activity_vertical_margin&quot;     tools:context=&quot;.ListActivity&quot; &gt;      &lt;ExpandableListView         android:id=&quot;@+id\/listView1&quot;         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot;         android:indicatorLeft=&quot;200dp&quot; \/&gt;  &lt;\/LinearLayout&gt; <\/code><\/pre>\n<p>  \u041d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u2014 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 <b>LinearLayout<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0434\u0432\u0443\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a <b>ExpandableListView<\/b>.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0443\u043d\u043a\u0442 \u0441\u043f\u0438\u0441\u043a\u0430 &#8212;<b> item_friend.xml<\/b>:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     android:id=&quot;@+id\/friendLayout&quot;     android:layout_width=&quot;match_parent&quot;     android:layout_height=&quot;wrap_content&quot;     android:orientation=&quot;horizontal&quot; &gt;      &lt;ImageView         android:id=&quot;@+id\/photoFriend&quot;         android:layout_width=&quot;60dp&quot;         android:layout_height=&quot;60dp&quot;         android:contentDescription=&quot;@string\/todo&quot;         android:src=&quot;@android:drawable\/ic_menu_camera&quot; \/&gt;      &lt;TextView         android:id=&quot;@+id\/f_s_names&quot;         android:layout_width=&quot;0dp&quot;         android:layout_height=&quot;wrap_content&quot;         android:layout_gravity=&quot;center&quot;         android:layout_marginLeft=&quot;10dp&quot;         android:layout_weight=&quot;1&quot;         android:text=&quot;@string\/Def_fname&quot;         android:textAppearance=&quot;?android:attr\/textAppearanceMedium&quot; \/&gt;      &lt;ImageView         android:id=&quot;@+id\/congratuated&quot;         android:layout_width=&quot;wrap_content&quot;         android:layout_height=&quot;wrap_content&quot;         android:layout_gravity=&quot;center&quot;         android:layout_marginRight=&quot;7dp&quot;         android:contentDescription=&quot;@string\/todo&quot;         android:src=&quot;@android:drawable\/checkbox_on_background&quot;         android:visibility=&quot;gone&quot; \/&gt;  &lt;\/LinearLayout&gt; <\/code><\/pre>\n<p>  \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u0432 <b>ImageView<\/b>, \u0438\u043c\u044f \u0438 \u0444\u0430\u043c\u0438\u043b\u0438\u044e \u0432 <b>TextView<\/b>, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d <b>ImageView<\/b>. \u041d\u0430\u0431\u043e\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u044b\u043c \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  \u041e\u043f\u0438\u0448\u0435\u043c \u043c\u0435\u043d\u044e \u043f\u0443\u043d\u043a\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u2014 <b>item_friend_menu.xml<\/b>:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     android:layout_width=&quot;match_parent&quot;     android:layout_height=&quot;match_parent&quot;     android:layout_marginTop=&quot;10dp&quot;     android:orientation=&quot;vertical&quot;     android:background=&quot;#E0E0E0&quot; &gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot;         android:layout_marginLeft=&quot;25dp&quot;         android:orientation=&quot;horizontal&quot; &gt;          &lt;TextView             android:id=&quot;@+id\/textNick&quot;             style=&quot;@style\/Fm&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:text=&quot;@string\/nick_&quot;  \/&gt;          &lt;TextView             android:id=&quot;@+id\/m_Nick&quot;             style=&quot;@style\/Fm&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_marginLeft=&quot;5dp&quot;             android:text=&quot;@string\/empty&quot; \/&gt;     &lt;\/LinearLayout&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot;         android:layout_marginLeft=&quot;25dp&quot;         android:orientation=&quot;horizontal&quot; &gt;          &lt;TextView             android:id=&quot;@+id\/textSex&quot;             style=&quot;@style\/Fm&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:text=&quot;@string\/sex_&quot; \/&gt;          &lt;TextView             android:id=&quot;@+id\/m_Sex&quot;             style=&quot;@style\/Fm&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_marginLeft=&quot;5dp&quot;             android:text=&quot;@string\/man&quot; \/&gt;     &lt;\/LinearLayout&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot;         android:layout_marginLeft=&quot;25dp&quot;         android:orientation=&quot;horizontal&quot; &gt;          &lt;TextView             android:id=&quot;@+id\/textBdate&quot;             style=&quot;@style\/Fm&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_gravity=&quot;center_vertical&quot;             android:text=&quot;@string\/brithday_&quot; \/&gt;          &lt;TextView             android:id=&quot;@+id\/m_Bdate&quot;             style=&quot;@style\/Fm&quot;             android:layout_width=&quot;0dp&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_gravity=&quot;center_vertical&quot;             android:layout_marginLeft=&quot;5dp&quot;             android:layout_weight=&quot;1&quot;             android:text=&quot;@string\/_17_2_1985&quot; \/&gt;          &lt;ImageButton             android:id=&quot;@+id\/imageEditdate&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_marginRight=&quot;7dp&quot;             android:adjustViewBounds=&quot;true&quot;             android:background=&quot;@android:color\/transparent&quot;             android:contentDescription=&quot;@string\/todo&quot;             android:scaleType=&quot;fitCenter&quot;             android:src=&quot;@android:drawable\/ic_menu_edit&quot; \/&gt;      &lt;\/LinearLayout&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot;         android:layout_marginLeft=&quot;25dp&quot;         android:orientation=&quot;horizontal&quot; &gt;          &lt;TextView             android:id=&quot;@+id\/textTemplate&quot;             style=&quot;@style\/Fm&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_gravity=&quot;center_vertical&quot;             android:text=&quot;@string\/template_&quot; \/&gt;          &lt;TextView             android:id=&quot;@+id\/m_Template&quot;             style=&quot;@style\/Fm&quot;             android:layout_width=&quot;0dp&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_gravity=&quot;center_vertical&quot;             android:layout_marginLeft=&quot;5dp&quot;             android:layout_weight=&quot;1&quot;             android:text=&quot;@string\/temp_name&quot; \/&gt;          &lt;ImageButton             android:id=&quot;@+id\/imageSelectTemp&quot;              android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_marginRight=&quot;7dp&quot;             android:adjustViewBounds=&quot;true&quot;             android:background=&quot;@android:color\/transparent&quot;             android:scaleType=&quot;fitCenter&quot;             android:src=&quot;@android:drawable\/ic_menu_edit&quot;              android:contentDescription=&quot;@string\/todo&quot;\/&gt;     &lt;\/LinearLayout&gt;  &lt;\/LinearLayout&gt; <\/code><\/pre>\n<p>  \u0421 \u043c\u0435\u043d\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u0441\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u2014 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u0435.<br \/>  \u0412\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 XML \u0433\u043e\u0442\u043e\u0432\u044b, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043a\u043e\u0434\u0438\u043d\u0433\u0443 \u043d\u0430 <b>Java<\/b>. \u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0432\u0430 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u043c\u0435\u043d\u044e \u044d\u0442\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0438\u0448\u0435\u043c \u043c\u0435\u043d\u044e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <b>FriendMenu.java<\/b>:<\/p>\n<pre><code class=\"java\"> public class FriendMenu {  \tpublic FriendMenu() { \t\t \t} \tprivate String nick, bdate, template_name; \tprivate int sex; \t \tpublic String getNick() { \t\treturn nick; \t} \tpublic void setNick(String nick) { \t\tthis.nick = nick; \t} \tpublic String getBdate() { \t\treturn bdate; \t} \tpublic void setBdate(String bdate) { \t\tthis.bdate = bdate; \t} \tpublic int getSex() { \t\treturn sex; \t} \tpublic void setSex(int sex) { \t\tthis.sex = sex; \t} \tpublic String getTemplate_name() { \t\treturn template_name; \t} \tpublic void setTemplate_name(String template_name) { \t\tthis.template_name = template_name; \t} \tpublic int getId() { \t\treturn user_id; \t} \tpublic void setId(int id) { \t\tthis.user_id = id; \t}  }<\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u0440\u0435\u0435 \u043d\u0435 \u043a\u0430\u043a \u043c\u0435\u043d\u044e, \u0430 \u043a\u0430\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 \u0441\u043f\u0438\u0441\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<br \/>  \u0417\u0434\u0435\u0441\u044c 4 \u043f\u043e\u043b\u044f \u2014 \u043d\u0438\u043a, \u0434\u0435\u043d\u044c \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f, \u043f\u043e\u043b \u0438 \u043f\u043e\u043b\u0435 template_name, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u044b <b>get<\/b>* \u0438 <b>set*<\/b> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044f <b><i>sex<\/i><\/b> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f <b>boolean<\/b>, \u043d\u043e \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>int<\/b>, \u0442.\u043a. \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0434\u0440\u0443\u0437\u0435\u0439, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u043e\u043c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u043e\u043b \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430(?).<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0438\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 <b>Friend.java<\/b>:<\/p>\n<pre><code class=\"java\"> public class Friend { \t \tpublic Friend() { \t\t \t}\t  \tprivate ArrayList&lt;FriendMenu&gt; menu; \tprivate Bitmap bmp; \tprivate String text; \tprivate boolean congratulated; \t \tpublic ArrayList&lt;FriendMenu&gt; getMenu() { \t\treturn menu; \t} \tpublic void setMenu(ArrayList&lt;FriendMenu&gt; menus) { \t\tthis.menu = menus; \t} \tpublic boolean isCongratulated() { \t\treturn congratulated; \t} \tpublic void setCongratulated(boolean congratulated) { \t\tthis.congratulated = congratulated; \t} \tpublic Bitmap getBmp() { \t\treturn bmp; \t} \tpublic void setBmp(Bitmap bmp) { \t\tthis.bmp=bmp; \t} \tpublic String getText() { \t\treturn text; \t} \tpublic void setText(String text) { \t\tthis.text = text; \t} }<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0435 <b>bmp<\/b> \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f <b>ImageView<\/b> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430, \u043f\u043e\u043b\u0435 <b>text<\/b> \u2014 \u0438\u043c\u044f \u0438 \u0444\u0430\u043c\u0438\u043b\u0438\u044e, \u043f\u043e\u043b\u0435 <b>congratulated<\/b> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u043e\u043a\u0430\u0437 \u0433\u0430\u043b\u043e\u0447\u043a\u0438 \u0432 <b>ImageView<\/b>.<br \/>  \u0412 \u043a\u043b\u0430\u0441\u0441\u0435 \u0441\u043e\u0434\u0438\u0440\u0436\u0438\u0442\u0441\u044f \u043f\u043e\u043b\u0435 <b>menu<\/b> \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043c\u0435\u043d\u044e\u0448\u0435\u043a \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430. \u041f\u043e\u043c\u0438\u043c\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442 1-\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0432\u043e\u0435\u043c \u043c\u0435\u043d\u044e. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <b>menu<\/b> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. <br \/>  \u0417\u0434\u0435\u0441\u044c \u0443 \u0432\u0430\u0441, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438, \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435 \u0446\u0435\u043f\u043b\u044f\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0441\u044c <b>Layout<\/b> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u0430 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435, \u0442.\u043a. \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 (\u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 <b>LinearLayout<\/b>, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e 2 <b>TextView<\/b> [\u0438 <b>ImageButton<\/b>]), \u0430 \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d, \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <b>BaseExpandableListAdapter<\/b> \u2014 <b>FriendsAdapted.java<\/b>.<\/p>\n<pre><code class=\"java\"> public class FriendsAdapted extends BaseExpandableListAdapter {  \tprivate ArrayList&lt;Friend&gt; friends; \tprivate LayoutInflater inflater;  \t\/\/ \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0440\u0443\u0433 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0435 \u043c\u0435\u043d\u044e (\u0434\u043e\u043f. \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e). \tpublic FriendsAdapted(Context cont, ArrayList&lt;Friend&gt; list) { \t\tinflater = LayoutInflater.from(cont); \t\tfriends = list; \t}  \t@Override \tpublic int getGroupCount() {  \t\treturn friends.size(); \t}  \t@Override \tpublic int getChildrenCount(int groupPosition) {  \t\treturn friends.get(groupPosition).getMenu().size(); \t}  \t@Override \tpublic Object getGroup(int groupPosition) {  \t\treturn friends.get(groupPosition); \t}  \t@Override \tpublic Object getChild(int groupPosition, int childPosition) { \t\t \t\treturn friends.get(groupPosition).getMenu().get(childPosition); \t}  \t@Override \tpublic long getGroupId(int groupPosition) {  \t\treturn groupPosition; \t}  \t@Override \tpublic long getChildId(int groupPosition, int childPosition) {  \t\treturn childPosition; \t}  \t@Override \tpublic boolean hasStableIds() {  \t\treturn true; \t}  \t@Override \tpublic View getGroupView(int groupPosition, boolean isExpanded, \t\t\tView convertView, ViewGroup parent) { \t\tif (convertView == null) { \t\t\tconvertView = inflater.inflate(R.layout.item_friend, null); \t\t} \t\t\/\/ \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0443 (\u0434\u0440\u0443\u0433\u0430) \t\tFriend fr = friends.get(groupPosition); \t\t((TextView) convertView.findViewById(R.id.f_s_names)).setText(fr \t\t\t\t.getText());  \t\t\/\/ ((ImageView) \t\t\/\/ convertView.findViewById(R.id.photoFriend)).setImageBitmap(fr.getBmp()); \t\t((ImageView) convertView.findViewById(R.id.congratuated)) \t\t\t\t.setVisibility((fr.isCongratulated() ? View.VISIBLE : View.GONE)); \t\treturn convertView; \t}  \t@Override \tpublic View getChildView(int groupPosition, int childPosition, \t\t\tboolean isLastChild, View convertView, ViewGroup parent) { \t\tFriendMenu menu = (FriendMenu) getChild(groupPosition, childPosition); \t\tconvertView = inflater \t\t\t\t.inflate(R.layout.item_friend_menu, parent, false);  \t\t((TextView) convertView.findViewById(R.id.m_Nick)).setText(menu \t\t\t\t.getNick());  \t\tswitch (menu.getSex()) { \t\tcase 1: \t\t\t((TextView) convertView.findViewById(R.id.m_Sex)) \t\t\t\t\t.setText(R.string.sex_man); \t\t\tbreak; \t\tcase 0: \t\t\t((TextView) convertView.findViewById(R.id.m_Sex)) \t\t\t\t\t.setText(R.string.sex_fem); \t\t\tbreak; \t\t} \t\t((TextView) convertView.findViewById(R.id.m_Bdate)).setText(menu \t\t\t\t.getBdate()); \t\t((TextView) convertView.findViewById(R.id.m_Template)).setText(menu \t\t\t\t.getTemplate_name()); \t\treturn convertView; \t}  \t@Override \tpublic boolean isChildSelectable(int groupPosition, int childPosition) {  \t\treturn false; \t}  }<\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0434\u0440\u0443\u0437\u0435\u0439, \u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0440\u0443\u0433 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043c\u0435\u043d\u044e. \u0414\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b <b>getGroupView<\/b> \u0438 <b>getChildView<\/b> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b>LayoutInflater<\/b> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 <b>Layout<\/b>&#8216;\u044b.<br \/>  \u041a\u0430\u0436\u0434\u043e\u043c\u0443 <b>View<\/b> \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0435\u0442 \u0441\u0432\u043e\u0438:  <\/p>\n<ul>\n<li>Selector<\/li>\n<li>ClickListener<\/li>\n<li>LongClickListener<\/li>\n<li>\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438<\/li>\n<\/ul>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a. \u041a\u043e\u0434 <b>ListActivity.java<\/b>:<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u044b\u043b\u0430 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0434\u0440\u0443\u0437\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043f\u0438\u0441\u043e\u043a \u0431\u0443\u0434\u0443 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438\u0437 \u043d\u0435\u0435:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/658\/099\/870\/658099870cf6f4d6a0b1d3aa8f912fac.png\"\/><\/p>\n<pre><code class=\"java\">public class ListActivity extends ActionBarActivity {  \tExpandableListView list_w; \tstatic private SQLdb data; \t@Override \tprotected void onCreate(Bundle savedInstanceState) { \t\tsuper.onCreate(savedInstanceState); \t\tsetContentView(R.layout.activity_list); \t\tlist_w = (ExpandableListView) findViewById(R.id.listView1);\t\t \t\tdata = new SQLdb(this, 2); \t\tSQLiteDatabase db = data.getReadableDatabase(); \t\tCursor c = db.rawQuery(&quot;select * from friends&quot;, null); \t\tArrayList&lt;Friend&gt; friends = new ArrayList&lt;Friend&gt;(); \t\tif (c.moveToFirst()) { \t\t\tfor (int i = 0; i &lt; c.getCount(); ++i) { \t\t\t\tFriend friend = new Friend(); \t\t\t\tArrayList&lt;FriendMenu&gt; menus = new ArrayList&lt;FriendMenu&gt;(); \t\t\t\tFriendMenu menu = new FriendMenu(); \t\t\t\tmenu.setBdate(c.getString(c.getColumnIndex(&quot;bdate&quot;))); \t\t\t\tmenu.setNick(c.getString(c.getColumnIndex(&quot;nickname&quot;))); \t\t\t\tmenu.setSex(c.getInt(c.getColumnIndex(&quot;sex&quot;))); \t\t\t\tmenus.add(menu); \t\t\t\tfriend.setMenu(menus); \t\t\t\tfriend.setText(c.getString(c.getColumnIndex(&quot;fname&quot;)) \t\t\t\t\t\t+ &quot;  &quot; + c.getString(c.getColumnIndex(&quot;sname&quot;))); \t\t\t\tif (i % 2 == 0) { \t\t\t\t\tfriend.setCongratulated(true); \t\t\t\t} \t\t\t\tfriends.add(friend); \t\t\t\tif (!c.moveToNext()) { \t\t\t\t\tbreak; \t\t\t\t} \t\t\t} \t\t} else Toast.makeText(this, &quot;You have not friends!&quot;, Toast.LENGTH_SHORT).show(); \t\tc.close(); \t\tdb.close(); \t\tFriendsAdapted friendsadapter=new FriendsAdapted(this,friends); \t\tlist_w.setAdapter(friendsadapter); \t\tlist_w.setDivider(getResources().getDrawable(R.drawable.line)); \t\tlist_w.setDividerHeight(2);\t\t\t \t} }<\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043e\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0430\u043d\u0434\u0440\u043e\u0438\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c. \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\/227549\/\"> http:\/\/habrahabr.ru\/post\/227549\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u043d\u0430\u044e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<b> Lucky Patcher<\/b>, \u0432 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0434\u0435\u043b\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e: \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u0435\u0441\u0442\u044c \u043c\u0435\u043d\u044e. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/059\/f6a\/2d5\/059f6a2d588037e5427ca80065303b4a.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-227549","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/227549","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=227549"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/227549\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=227549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=227549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=227549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}