{"id":2625,"date":"2016-04-21T11:23:05","date_gmt":"2016-04-21T11:23:05","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=2625"},"modified":"2016-04-21T11:23:05","modified_gmt":"2016-04-21T11:23:05","slug":"create-a-navigation-drawer-in-android","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2016\/04\/21\/create-a-navigation-drawer-in-android\/","title":{"rendered":"Create A Navigation Drawer in Android"},"content":{"rendered":"            <script type=\"text\/javascript\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/plugins\/wordpress-code-snippet\/scripts\/shBrushXml.js\"><\/script>\n            <script type=\"text\/javascript\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/plugins\/wordpress-code-snippet\/scripts\/shBrushJava.js\"><\/script>\n<h4>OVERVIEW<\/h4>\n<p>Most modern apps have a sliding Navigation Drawer as the main navigation element. This seems to be the modern version replacement of the sliding TabHost which was the main navigation element a few years back. Note that this UI component is not natively available for Android versions older than 4.x (Icecream Sandwich). The example below is meant for apps targeting SDK 19 and later i.e. KitKat and later. Perhaps it might work for slightly older versions, but I am not sure.<\/p>\n<h4>METHODOLOGY<\/h4>\n<p>We create the NavigationDrawer as a Fragment which can be called from multiple Activities. So if your app has 5 Activity screens, then each of them will call this Fragment in code and also provide for it in their layouts. The example has a single Activity only called MainActivity<\/p>\n<h5>Layouts<\/h5>\n<p>The layout for MainActivity called activity_main.xml will have the root layout as<\/p>\n<pre>android.support.v4.widget.DrawerLayout<\/pre>\n<p>instead of the standard LinearLayout or RelativeLayout . Within\u00a0 the root layout there is a FrameLayout. Below the FrameLayout there be a single layout (LinearLayout in this case) which will hold the content for the Activity. Below this single layout, the fragment for the NavigationDrawer will be placed.<\/p>\n<p>The NavigationDrawer itself consists of two layouts <em>drawer_drawer.xml <\/em> and <em>drawer_header.xml . <\/em><\/p>\n<p>As the names suggest, the main drawer component UI is set in drawer_drawer and the header UI is fixed in drawer_header.<\/p>\n<p>Since we are going to put a menu with submenus within the drawer, we have two additional layout files &#8211; one to fix the UI for the top level menu groups\u00a0 <em>list_group.xml<\/em> and the second for the submenu items &#8211; <em>list_item.xml<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>It is not necessary that the NavigationDrawer should only have menus. It can contain anything ,but most of the times a menu is the standard usage pattern for it.<\/p>\n<h5>Drawables<\/h5>\n<p>We have three drawables used here:<\/p>\n<p><em>ic_drawer.png<\/em> &#8211; the icon for drawer<\/p>\n<p><em>actionbar_background.xml<\/em> &#8211; background UI for the drawer when it is open<\/p>\n<p><em>drawer_shadow_9.png<\/em>\u00a0 &#8211; a 9 patch image for dropping a shadow when the drawer is visible<\/p>\n<p>&nbsp;<\/p>\n<h5>Values<\/h5>\n<p><em>dimens.xml &#8211; <\/em>standard dimension values for the navigation drawer<\/p>\n<p><em>styles.xml<\/em> &#8211; style settings for the app<\/p>\n<p><em>strings.xml<\/em> &#8211; various string values used in the drawer<\/p>\n<p>&nbsp;<\/p>\n<h5>Assets<\/h5>\n<p>We will be putting icons for each menu item group in the Drawer, so we will use<em> font awesome<\/em> to put icons within our menu text. You can , use images or icons directly, but its easier to use font-awesome if you are just looking for standard icon notation.<\/p>\n<p>Within our app folder, we will create <em>assets <\/em>folder and within that the <em>fonts <\/em>folder. Within the fonts folder will put the ttf file for font-awesome.<\/p>\n<h5>Classes<\/h5>\n<p><em>MainActivity.class<\/em> &#8211; the main activity which will call the drawer.<\/p>\n<p><em>NavigationDrawerFragment.class<\/em> &#8211; the Class to handle the drawer fragment<\/p>\n<p><em>ExpandableListDataPump.class<\/em> &#8211; this provides the menu content<\/p>\n<p><em>ExpandableListAdapter.class<\/em> &#8211; the expandable list handler which will control the menu<\/p>\n<p><em>FontManager.class<\/em> &#8211; Utility class to access Font-awesome<\/p>\n<p>&nbsp;<\/p>\n<h4>SOURCE LISTINGS<\/h4>\n<p><strong>AndroidManifest.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;manifest xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    package=&quot;navdrawer.test.com.navigationdrawertest&quot;&gt;\r\n\r\n    &lt;uses-sdk\r\n        android:minSdkVersion=&quot;19&quot;\r\n        android:targetSdkVersion=&quot;23&quot; \/&gt;\r\n\r\n    &lt;application\r\n        android:allowBackup=&quot;true&quot;\r\n        android:icon=&quot;@mipmap\/ic_launcher&quot;\r\n        android:label=&quot;@string\/app_name&quot;\r\n        android:supportsRtl=&quot;true&quot;\r\n        android:theme=&quot;@style\/AppTheme&quot;&gt;\r\n        &lt;activity\r\n            android:name=&quot;.MainActivity&quot;\r\n            android:label=&quot;@string\/app_name&quot;\r\n            android:theme=&quot;@style\/AppTheme&quot;&gt;\r\n            &lt;intent-filter&gt;\r\n                &lt;action android:name=&quot;android.intent.action.MAIN&quot; \/&gt;\r\n\r\n                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; \/&gt;\r\n            &lt;\/intent-filter&gt;\r\n        &lt;\/activity&gt;\r\n    &lt;\/application&gt;\r\n\r\n&lt;\/manifest&gt;\r\n<\/pre><\/p>\n<p><strong>actionbar_background.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;shape xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    android:shape=&quot;rectangle&quot;&gt;\r\n    &lt;gradient\r\n        android:startColor=&quot;#444444&quot;\r\n        android:endColor=&quot;#aaaaaa&quot;\r\n        android:angle=&quot;0&quot; \/&gt;\r\n&lt;\/shape&gt;<\/pre><\/p>\n<p><strong>activity_main.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;android.support.v4.widget.DrawerLayout  xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;\r\n    android:layout_width=&quot;match_parent&quot;\r\n    android:layout_height=&quot;match_parent&quot;\r\n    android:id=&quot;@+id\/main_layout&quot;\r\n    android:background=&quot;#ffffff&quot;\r\n    tools:context=&quot;navdrawer.test.com.navigationdrawertest.MainActivity&quot;&gt;\r\n\r\n    &lt;!-- As the main content view, the view below consumes the entire\r\n      space available using match_parent in both dimensions. --&gt;\r\n    &lt;FrameLayout\r\n        android:id=&quot;@+id\/container&quot;\r\n        android:layout_width=&quot;match_parent&quot;\r\n        android:layout_height=&quot;match_parent&quot; \/&gt;\r\n\r\n    &lt;LinearLayout\r\n        android:orientation=&quot;vertical&quot;\r\n        android:layout_width=&quot;match_parent&quot;\r\n        android:layout_height=&quot;wrap_content&quot;\r\n        android:layout_centerVertical=&quot;true&quot;\r\n        android:layout_centerHorizontal=&quot;true&quot;\r\n        android:paddingTop=&quot;20dp&quot;\r\n        android:paddingBottom=&quot;20dp&quot;\r\n        android:paddingLeft=&quot;10dp&quot;\r\n        android:paddingRight=&quot;10dp&quot;\r\n\r\n        &gt;\r\n\r\n        &lt;TextView\r\n            android:layout_width=&quot;wrap_content&quot;\r\n            android:layout_height=&quot;wrap_content&quot;\r\n            android:text=&quot;Content comes here&quot;\r\n        \/&gt;\r\n\r\n    &lt;\/LinearLayout&gt;\r\n\r\n    &lt;!-- The drawer is given a fixed width in dp and extends the full height of\r\n       the container. --&gt;\r\n    &lt;fragment android:id=&quot;@+id\/navigation_drawer&quot;\r\n        android:layout_width=&quot;@dimen\/navigation_drawer_width&quot;\r\n        android:layout_height=&quot;match_parent&quot;\r\n        android:layout_gravity=&quot;start&quot;\r\n\r\n        android:name=&quot;navdrawer.test.com.navigationdrawertest.NavigationDrawerFragment&quot;\r\n        tools:layout=&quot;@layout\/drawer_drawer&quot; \/&gt;\r\n\r\n\r\n&lt;\/android.support.v4.widget.DrawerLayout&gt;\r\n<\/pre><\/p>\n<p><strong>drawer_drawer.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;ExpandableListView xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    android:id=&quot;@+id\/list_slidermenu&quot;\r\n    android:layout_width=&quot;300dp&quot;\r\n    android:layout_height=&quot;match_parent&quot;\r\n    android:layout_gravity=&quot;start&quot;\r\n    android:background=&quot;@drawable\/actionbar_background&quot;\r\n    android:choiceMode=&quot;singleChoice&quot;\r\n    android:divider=&quot;#ffffff&quot;\r\n    android:dividerHeight=&quot;0.2dp&quot;\r\n    android:groupIndicator=&quot;@null&quot;\r\n    android:alpha=&quot;255&quot;\r\n    android:indicatorLeft=&quot;?android:attr\/expandableListPreferredItemIndicatorLeft&quot;\r\n    &gt;\r\n&lt;\/ExpandableListView&gt;<\/pre><\/p>\n<p><strong>drawer_header.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;FrameLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    android:layout_width=&quot;match_parent&quot;\r\n    android:layout_height=&quot;wrap_content&quot; &gt;\r\n    &lt;RelativeLayout\r\n        android:id=&quot;@+id\/RelativeLayout1&quot;\r\n        android:layout_width=&quot;match_parent&quot;\r\n        android:layout_height=&quot;80dp&quot;\r\n        android:background=&quot;#000000&quot; &gt;\r\n        &lt;TextView\r\n            android:id=&quot;@+id\/textDrawerHeading&quot;\r\n            android:layout_width=&quot;match_parent&quot;\r\n            android:layout_height=&quot;match_parent&quot;\r\n            android:layout_alignParentTop=&quot;true&quot;\r\n            android:layout_margin=&quot;5dp&quot;\r\n            android:textAlignment=&quot;center&quot;\r\n            android:gravity=&quot;center_vertical&quot;\r\n            android:text=&quot;Header Text Comes Here&quot;\r\n            android:textAppearance=&quot;?android:attr\/textAppearanceMedium&quot;\r\n            android:textColor=&quot;#ffffff&quot;\r\n            android:textStyle=&quot;bold&quot; \/&gt;\r\n\r\n    &lt;\/RelativeLayout&gt;\r\n&lt;\/FrameLayout&gt;<\/pre><\/p>\n<p><strong>list_group.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n\r\n&lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    android:orientation=&quot;horizontal&quot; android:layout_width=&quot;match_parent&quot;\r\n    android:layout_height=&quot;match_parent&quot;&gt;\r\n\r\n    &lt;TextView\r\n        android:id=&quot;@+id\/listTitleIcon&quot;\r\n        android:layout_width=&quot;fill_parent&quot;\r\n        android:layout_height=&quot;wrap_content&quot;\r\n        android:paddingLeft=&quot;5dp&quot;\r\n        android:textColor=&quot;#ffffff&quot;\r\n        android:paddingTop=&quot;12dp&quot;\r\n        android:paddingBottom=&quot;12dp&quot;\r\n        android:layout_weight=&quot;0.60&quot;\r\n        android:textSize=&quot;18dp&quot;\/&gt;\r\n    &lt;TextView\r\n        android:id=&quot;@+id\/listTitle&quot;\r\n        android:layout_width=&quot;fill_parent&quot;\r\n        android:layout_height=&quot;wrap_content&quot;\r\n        android:paddingLeft=&quot;5dp&quot;\r\n        android:textColor=&quot;#ffffff&quot;\r\n        android:paddingTop=&quot;12dp&quot;\r\n        android:paddingBottom=&quot;12dp&quot;\r\n        android:layout_weight=&quot;0.20&quot;\/&gt;\r\n    &lt;TextView\r\n        android:id=&quot;@+id\/listTitleArrow&quot;\r\n        android:layout_width=&quot;fill_parent&quot;\r\n        android:layout_height=&quot;wrap_content&quot;\r\n        android:paddingRight=&quot;5dp&quot;\r\n        android:textColor=&quot;#ffffff&quot;\r\n        android:paddingTop=&quot;12dp&quot;\r\n        android:paddingBottom=&quot;12dp&quot;\r\n        android:layout_weight=&quot;0.60&quot;\r\n        android:textAlignment=&quot;viewEnd&quot;\r\n        android:text=&quot;X&quot;\r\n        android:textSize=&quot;18dp&quot;\/&gt;\r\n\r\n&lt;\/LinearLayout&gt;\r\n<\/pre><\/p>\n<p><strong>list_item.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n\r\n&lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    android:orientation=&quot;vertical&quot; android:layout_width=&quot;match_parent&quot;\r\n    android:layout_height=&quot;wrap_content&quot;&gt;\r\n    &lt;TextView\r\n        android:id=&quot;@+id\/expandedListItem&quot;\r\n        android:layout_width=&quot;fill_parent&quot;\r\n        android:layout_height=&quot;wrap_content&quot;\r\n        android:textColor=&quot;#ffffff&quot;\r\n        android:paddingLeft=&quot;60dp&quot;\r\n        android:paddingTop=&quot;10dp&quot;\r\n        android:paddingBottom=&quot;10dp&quot; \/&gt;\r\n&lt;\/LinearLayout&gt;\r\n<\/pre><\/p>\n<p><strong>dimens.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;resources&gt;\r\n    &lt;!-- Default screen margins, per the Android Design guidelines. --&gt;\r\n    &lt;dimen name=&quot;activity_horizontal_margin&quot;&gt;16dp&lt;\/dimen&gt;\r\n    &lt;dimen name=&quot;activity_vertical_margin&quot;&gt;16dp&lt;\/dimen&gt;\r\n\r\n    &lt;!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:\r\n       https:\/\/developer.android.com\/design\/patterns\/navigation-drawer.html --&gt;\r\n    &lt;dimen name=&quot;navigation_drawer_width&quot;&gt;240dp&lt;\/dimen&gt;\r\n\r\n&lt;\/resources&gt;\r\n<\/pre><\/p>\n<p><strong>strings.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;resources&gt;\r\n    &lt;string name=&quot;app_name&quot;&gt;NavigationDrawerTest&lt;\/string&gt;\r\n    &lt;string name=&quot;action_settings&quot;&gt;Settings&lt;\/string&gt;\r\n    &lt;string name=&quot;drawer_open&quot;&gt;&lt;\/string&gt;\r\n    &lt;string name=&quot;drawer_close&quot;&gt;&lt;\/string&gt;\r\n\r\n    &lt;string name=&quot;fa_glass&quot;&gt;&amp;#xf000;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_music&quot;&gt;&amp;#xf001;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_search&quot;&gt;&amp;#xf002;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_envelope_o&quot;&gt;&amp;#xf003;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_heart&quot;&gt;&amp;#xf004;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_star&quot;&gt;&amp;#xf005;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_star_o&quot;&gt;&amp;#xf006;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_user&quot;&gt;&amp;#xf007;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_film&quot;&gt;&amp;#xf008;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_chevron_right&quot;&gt;&amp;#xf054;&lt;\/string&gt;\r\n    &lt;string name=&quot;fa_chevron_down&quot;&gt;&amp;#xf078;&lt;\/string&gt;\r\n&lt;\/resources&gt;\r\n<\/pre><\/p>\n<p><strong>styles.xml<\/strong><br \/>\n<pre class=\"brush: xml\">&lt;resources&gt;\r\n\r\n    &lt;!-- Base application theme. --&gt;\r\n    &lt;style name=&quot;AppTheme&quot; parent=&quot;Theme.AppCompat.Light.DarkActionBar&quot;&gt;\r\n        &lt;!-- Customize your theme here. --&gt;\r\n        &lt;item name=&quot;colorPrimary&quot;&gt;@color\/colorPrimary&lt;\/item&gt;\r\n        &lt;item name=&quot;colorPrimaryDark&quot;&gt;@color\/colorPrimaryDark&lt;\/item&gt;\r\n        &lt;item name=&quot;colorAccent&quot;&gt;@color\/colorAccent&lt;\/item&gt;\r\n    &lt;\/style&gt;\r\n\r\n\r\n\r\n&lt;\/resources&gt;\r\n<\/pre><\/p>\n<p><strong>ExpandableListAdapter.java<\/strong><br \/>\n<pre class=\"brush: java\">package navdrawer.test.com.navigationdrawertest;\r\n\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\nimport android.content.Context;\r\nimport android.graphics.Typeface;\r\nimport android.view.LayoutInflater;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.widget.BaseExpandableListAdapter;\r\nimport android.widget.ExpandableListView;\r\nimport android.widget.TextView;\r\nimport android.widget.ExpandableListView.OnGroupClickListener;\r\n\r\n\r\npublic class ExpandableListAdapter extends BaseExpandableListAdapter {\r\n\r\n    private Context context;\r\n    private List&lt;String&gt; expandableListTitle;\r\n    private HashMap&lt;String, List&lt;String&gt;&gt; expandableListDetail;\r\n\r\n    public static int ITEM1 = 0;\r\n    public static int ITEM2 = 1;\r\n    public static int ITEM3 = 2;\r\n    public static int ITEM4 = 3;\r\n\r\n\r\n    public static int SUBITEM1_1 = 0;\r\n    public static int SUBITEM1_2 = 1;\r\n    public static int SUBITEM1_3 = 2;\r\n    public static int SUBITEM1_4 = 3;\r\n\r\n\r\n    public static int SUBITEM2_1 = 0;\r\n    public static int SUBITEM2_2 = 1;\r\n    public static int SUBITEM2_3 = 2;\r\n    public static int SUBITEM2_4 = 3;\r\n   \r\n\r\n\r\n\r\n    public ExpandableListAdapter(Context context, List&lt;String&gt; expandableListTitle,\r\n                                 HashMap&lt;String, List&lt;String&gt;&gt; expandableListDetail) {\r\n        this.context = context;\r\n        this.expandableListTitle = expandableListTitle;\r\n        this.expandableListDetail = expandableListDetail;\r\n\r\n\r\n    }\r\n\r\n    @Override\r\n    public Object getChild(int listPosition, int expandedListPosition) {\r\n        return this.expandableListDetail.get(this.expandableListTitle.get(listPosition))\r\n                .get(expandedListPosition);\r\n    }\r\n\r\n    @Override\r\n    public long getChildId(int listPosition, int expandedListPosition) {\r\n        return expandedListPosition;\r\n    }\r\n\r\n    @Override\r\n    public View getChildView(int listPosition, final int expandedListPosition,\r\n                             boolean isLastChild, View convertView, ViewGroup parent) {\r\n        final String expandedListText = (String) getChild(listPosition, expandedListPosition);\r\n        if (convertView == null) {\r\n            LayoutInflater layoutInflater = (LayoutInflater) this.context\r\n                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r\n            convertView = layoutInflater.inflate(R.layout.list_item, null);\r\n        }\r\n        TextView expandedListTextView = (TextView) convertView\r\n                .findViewById(R.id.expandedListItem);\r\n        expandedListTextView.setText(expandedListText);\r\n        return convertView;\r\n    }\r\n\r\n    @Override\r\n    public int getChildrenCount(int listPosition) {\r\n        return this.expandableListDetail.get(this.expandableListTitle.get(listPosition))\r\n                .size();\r\n    }\r\n\r\n    @Override\r\n    public Object getGroup(int listPosition) {\r\n        return this.expandableListTitle.get(listPosition);\r\n    }\r\n\r\n    @Override\r\n    public int getGroupCount() {\r\n        return this.expandableListTitle.size();\r\n    }\r\n\r\n    @Override\r\n    public long getGroupId(int listPosition) {\r\n        return listPosition;\r\n    }\r\n\r\n    @Override\r\n    public View getGroupView(int listPosition, boolean isExpanded,\r\n                             View convertView, ViewGroup parent) {\r\n        String listTitle = (String) getGroup(listPosition);\r\n        if (convertView == null) {\r\n            LayoutInflater layoutInflater = (LayoutInflater) this.context.\r\n                    getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r\n            convertView = layoutInflater.inflate(R.layout.list_group, null);\r\n        }\r\n        TextView listTitleTextView = (TextView) convertView\r\n                .findViewById(R.id.listTitle);\r\n        listTitleTextView.setTypeface(null, Typeface.NORMAL);\r\n        listTitleTextView.setText(listTitle);\r\n\r\n\r\n        TextView listTitleTextArrowView = (TextView) convertView\r\n                .findViewById(R.id.listTitleArrow);\r\n        listTitleTextArrowView.setTypeface(null, Typeface.NORMAL);\r\n        listTitleTextArrowView.setTypeface(FontManager.getTypeface(context, FontManager.FONTAWESOME));\r\n\r\n        \/\/ set icons for menu items\r\n        TextView listTitleTextIconView = (TextView) convertView\r\n                .findViewById(R.id.listTitleIcon);\r\n        listTitleTextIconView.setTypeface(null, Typeface.NORMAL);\r\n        listTitleTextIconView.setTypeface(FontManager.getTypeface(context, FontManager.FONTAWESOME));\r\n        if (listPosition == ITEM1)\r\n            listTitleTextIconView.setText(context.getResources().getString(R.string.fa_glass));\r\n        else if (listPosition == ITEM2)\r\n            listTitleTextIconView.setText(context.getResources().getString(R.string.fa_music));\r\n        else if (listPosition == ITEM3)\r\n            listTitleTextIconView.setText(context.getResources().getString(R.string.fa_search));\r\n        else if (listPosition == ITEM4)\r\n            listTitleTextIconView.setText(context.getResources().getString(R.string.fa_envelope_o));\r\n\r\n        \/\/ set arrow icons for relevant items\r\n        if (listPosition == ITEM1 || listPosition == ITEM2) {\r\n            if (!isExpanded)\r\n                listTitleTextArrowView.setText(context.getResources().getString(R.string.fa_chevron_right));\r\n            else\r\n                listTitleTextArrowView.setText(context.getResources().getString(R.string.fa_chevron_down));\r\n        } else {\r\n            listTitleTextArrowView.setText(&quot;&quot;);\r\n\r\n        }\r\n        return convertView;\r\n    }\r\n\r\n    @Override\r\n    public boolean hasStableIds() {\r\n        return false;\r\n    }\r\n\r\n    @Override\r\n    public boolean isChildSelectable(int listPosition, int expandedListPosition) {\r\n        return true;\r\n    }\r\n\r\n}\r\n<\/pre><\/p>\n<p><strong>ExpandableListDataPump.java<\/strong><br \/>\n<pre class=\"brush: java\">package navdrawer.test.com.navigationdrawertest;\r\n\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.HashMap;\r\nimport java.util.LinkedHashMap;\r\nimport java.util.List;\r\n\r\npublic class ExpandableListDataPump {\r\n    public static HashMap&lt;String, List&lt;String&gt;&gt; getData() {\r\n        LinkedHashMap&lt;String, List&lt;String&gt;&gt; expandableListDetail = new LinkedHashMap&lt;String, List&lt;String&gt;&gt;();\r\n\r\n        List&lt;String&gt; menu3 = new ArrayList&lt;String&gt;();\r\n        List&lt;String&gt; menu4 = new ArrayList&lt;String&gt;();\r\n\r\n        List&lt;String&gt; list1 = new ArrayList&lt;String&gt;();\r\n        list1.add(&quot;Submenu 1&quot;);\r\n        list1.add(&quot;Submenu 2&quot;);\r\n        list1.add(&quot;Submenu 3&quot;);\r\n        list1.add(&quot;Submenu 4&quot;);\r\n\r\n\r\n        List&lt;String&gt; list2 = new ArrayList&lt;String&gt;();\r\n        list2.add(&quot;Submenu 1&quot;);\r\n        list2.add(&quot;Submenu 2&quot;);\r\n        list2.add(&quot;Submenu 3&quot;);\r\n        list2.add(&quot;Submenu 4&quot;);\r\n\r\n\r\n        expandableListDetail.put(&quot;Menu 1&quot;, list1);\r\n        expandableListDetail.put(&quot;Menu 2&quot;, list2);\r\n        expandableListDetail.put(&quot;Menu 3&quot;, menu3);\r\n        expandableListDetail.put(&quot;Menu 4&quot;, menu4);\r\n\r\n\r\n        return expandableListDetail;\r\n    }\r\n}\r\n<\/pre><\/p>\n<p><strong>FontManager.java<\/strong><br \/>\n<pre class=\"brush: java\">package navdrawer.test.com.navigationdrawertest;\r\n\r\n\r\n\r\nimport android.content.Context;\r\nimport android.graphics.Typeface;\r\nimport android.view.View;\r\n\r\n\/**\r\n * Created by amit on 26\/3\/16.\r\n *\/\r\npublic class FontManager {\r\n\r\n    public static final String ROOT = &quot;fonts\/&quot;,\r\n            FONTAWESOME = ROOT + &quot;fontawesome-webfont.ttf&quot;;\r\n\r\n    public static Typeface getTypeface(Context context, String font) {\r\n        return Typeface.createFromAsset(context.getAssets(), font);\r\n    }\r\n}\r\n<\/pre><\/p>\n<p><strong>MainActivity.java<\/strong><br \/>\n<pre class=\"brush: java\">package navdrawer.test.com.navigationdrawertest;\r\n\r\nimport android.content.Intent;\r\nimport android.support.v7.app.ActionBarActivity;\r\nimport android.app.Activity;\r\nimport android.support.v7.app.ActionBar;\r\nimport android.support.v4.app.Fragment;\r\nimport android.support.v4.app.ActionBarDrawerToggle;\r\nimport android.support.v4.view.GravityCompat;\r\nimport android.support.v4.widget.DrawerLayout;\r\nimport android.os.Bundle;\r\nimport android.view.Menu;\r\nimport android.view.MenuItem;\r\n\r\n\r\npublic class MainActivity extends ActionBarActivity\r\n        implements NavigationDrawerFragment.NavigationDrawerCallbacks {\r\n\r\n    private NavigationDrawerFragment mNavigationDrawerFragment;\r\n    private CharSequence mTitle;\r\n    private DrawerLayout mDrawerLayout;\r\n\r\n\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.activity_main);\r\n        getSupportActionBar().setTitle(&quot;Home&quot;);\r\n\r\n\r\n        \/\/ Set up the drawer.\r\n\r\n        mNavigationDrawerFragment = (NavigationDrawerFragment)\r\n                getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);\r\n        mTitle = getTitle();\r\n        mNavigationDrawerFragment.setUp(\r\n                R.id.navigation_drawer,\r\n                (DrawerLayout) findViewById(R.id.main_layout));\r\n\r\n        mDrawerLayout = (DrawerLayout) findViewById(R.id.main_layout);\r\n    }\r\n\r\n    @Override\r\n    public boolean onCreateOptionsMenu(Menu menu) {\r\n        \/\/ Inflate the menu; this adds items to the action bar if it is present.\r\n        getMenuInflater().inflate(R.menu.menu_main, menu);\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean onOptionsItemSelected(MenuItem item) {\r\n        \/\/ Handle action bar item clicks here. The action bar will\r\n        \/\/ automatically handle clicks on the Home\/Up button, so long\r\n        \/\/ as you specify a parent activity in AndroidManifest.xml.\r\n        int id = item.getItemId();\r\n\r\n        \/\/noinspection SimplifiableIfStatement\r\n        if (id == R.id.action_settings) {\r\n            return true;\r\n        }\r\n\r\n        return super.onOptionsItemSelected(item);\r\n    }\r\n\r\n    @Override\r\n    public void onNavigationDrawerItemSelected(int position) {\r\n        \/\/ update the main content by replacing fragments\r\n\r\n    }\r\n\r\n\r\n\r\n}\r\n<\/pre><\/p>\n<p><strong>NavigationDrawerFragment.java<\/strong><br \/>\n<pre class=\"brush: java\">package navdrawer.test.com.navigationdrawertest;\r\n\r\nimport android.content.Intent;\r\nimport android.support.v7.app.ActionBarActivity;\r\nimport android.app.Activity;\r\nimport android.support.v7.app.ActionBar;\r\nimport android.support.v4.app.Fragment;\r\nimport android.support.v7.app.ActionBarDrawerToggle;\r\nimport android.support.v4.view.GravityCompat;\r\nimport android.support.v4.widget.DrawerLayout;\r\nimport android.content.res.Configuration;\r\nimport android.os.Bundle;\r\nimport android.view.LayoutInflater;\r\nimport android.view.Menu;\r\nimport android.view.MenuInflater;\r\nimport android.view.MenuItem;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.widget.AdapterView;\r\nimport android.widget.ExpandableListView;\r\n\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\n\r\nimport android.widget.ExpandableListView.OnGroupCollapseListener;\r\nimport android.widget.ExpandableListView.OnGroupExpandListener;\r\n\r\n\/**\r\n * Fragment used for managing interactions for and presentation of a navigation drawer.\r\n * See the &lt;a href=&quot;https:\/\/developer.android.com\/design\/patterns\/navigation-drawer.html#Interaction&quot;&gt;\r\n * design guidelines&lt;\/a&gt; for a complete explanation of the behaviors implemented here.\r\n *\/\r\npublic class NavigationDrawerFragment extends Fragment {\r\n\r\n    private static final String STATE_SELECTED_POSITION = &quot;selected_navigation_drawer_position&quot;;\r\n\r\n    private NavigationDrawerCallbacks mCallbacks;\r\n\r\n    private ActionBarDrawerToggle mDrawerToggle;\r\n\r\n    private DrawerLayout mDrawerLayout;\r\n    private ExpandableListView mDrawerListView;\r\n    private View mFragmentContainerView;\r\n\r\n    private int mCurrentSelectedPosition = 0;\r\n\r\n\r\n    ArrayList&lt;String&gt; groupItem = new ArrayList&lt;String&gt;();\r\n    ArrayList&lt;Object&gt; childItem = new ArrayList&lt;Object&gt;();\r\n\r\n    List&lt;String&gt; expandableListTitle;\r\n    HashMap&lt;String, List&lt;String&gt;&gt; expandableListDetail;\r\n\r\n    public NavigationDrawerFragment() {\r\n    }\r\n\r\n    @Override\r\n    public void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n\r\n    }\r\n\r\n    @Override\r\n    public void onActivityCreated (Bundle savedInstanceState) {\r\n        super.onActivityCreated(savedInstanceState);\r\n        \/\/ Indicate that this fragment would like to influence the set of actions in the action bar.\r\n        setHasOptionsMenu(true);\r\n    }\r\n\r\n    @Override\r\n    public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n                             Bundle savedInstanceState) {\r\n        mDrawerListView = (ExpandableListView) inflater.inflate(\r\n                R.layout.drawer_drawer, container, false);\r\n        mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\r\n            @Override\r\n            public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {\r\n                selectItem(position);\r\n            }\r\n        });\r\n\r\n        expandableListDetail = ExpandableListDataPump.getData();\r\n        expandableListTitle = new ArrayList&lt;String&gt;(expandableListDetail.keySet());\r\n\r\n\r\n        mDrawerListView.setAdapter(new ExpandableListAdapter(getActivity(), expandableListTitle, expandableListDetail));\r\n\r\n        mDrawerListView.setOnGroupExpandListener(new OnGroupExpandListener() {\r\n\r\n            @Override\r\n            public void onGroupExpand(int groupPosition) {\r\n\r\n            }\r\n        });\r\n\r\n\r\n        mDrawerListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {\r\n            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {\r\n                boolean retVal = true;\r\n\r\n                if (groupPosition == ExpandableListAdapter.ITEM1) {\r\n                    retVal = false;\r\n                } else if (groupPosition == ExpandableListAdapter.ITEM2) {\r\n                    retVal = false;\r\n                } else if (groupPosition == ExpandableListAdapter.ITEM3) {\r\n\r\n                    \/\/ call some activity here\r\n                } else if (groupPosition == ExpandableListAdapter.ITEM4) {\r\n                    \/\/ call some activity here\r\n\r\n                }\r\n                return retVal;\r\n            }\r\n        });\r\n\r\n        mDrawerListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {\r\n\r\n            @Override\r\n            public boolean onChildClick(ExpandableListView parent, View v,\r\n                                        int groupPosition, int childPosition, long id) {\r\n\r\n                if (groupPosition == ExpandableListAdapter.ITEM1) {\r\n                    if (childPosition == ExpandableListAdapter.SUBITEM1_1) {\r\n\r\n                       \/\/ call activity here\r\n\r\n                    }\r\n                    else if (childPosition == ExpandableListAdapter.SUBITEM1_2) {\r\n\r\n                       \/\/ call activity here\r\n\r\n                    }\r\n                    else if (childPosition == ExpandableListAdapter.SUBITEM1_3) {\r\n\r\n                        \/\/ call activity here\r\n\r\n                    }\r\n                    else if (childPosition == ExpandableListAdapter.SUBITEM1_4) {\r\n\r\n                        \/\/ call activity here\r\n\r\n                    }\r\n\r\n\r\n                } else if (groupPosition == ExpandableListAdapter.ITEM2) {\r\n\r\n                    if (childPosition == ExpandableListAdapter.SUBITEM2_1) {\r\n\r\n                        \/\/ call activity here\r\n\r\n                    }\r\n                    else if (childPosition == ExpandableListAdapter.SUBITEM2_2) {\r\n\r\n                        \/\/ call activity here\r\n\r\n                    }\r\n                    else if (childPosition == ExpandableListAdapter.SUBITEM2_3) {\r\n\r\n                        \/\/ call activity here\r\n\r\n                    }\r\n                    else if (childPosition == ExpandableListAdapter.SUBITEM2_4) {\r\n\r\n                        \/\/ call activity here\r\n\r\n                    }\r\n\r\n\r\n                }\r\n                return true;\r\n            }\r\n        });\r\n\r\n        mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);\r\n\r\n        View header= inflater.inflate(R.layout.drawer_header, null);\r\n        mDrawerListView.addHeaderView(header);\r\n\r\n\r\n        return mDrawerListView;\r\n    }\r\n\r\n\r\n\r\n    public boolean isDrawerOpen() {\r\n        return mDrawerLayout != null &amp;&amp; mDrawerLayout.isDrawerOpen(mFragmentContainerView);\r\n    }\r\n\r\n    \/**\r\n     * Users of this fragment must call this method to set up the navigation drawer interactions.\r\n     *\r\n     * @param fragmentId   The android:id of this fragment in its activity&#039;s layout.\r\n     * @param drawerLayout The DrawerLayout containing this fragment&#039;s UI.\r\n     *\/\r\n    public void setUp(int fragmentId, DrawerLayout drawerLayout) {\r\n        mFragmentContainerView = getActivity().findViewById(fragmentId);\r\n        mDrawerLayout = drawerLayout;\r\n\r\n        \/\/ set a custom shadow that overlays the main content when the drawer opens\r\n        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);\r\n        \/\/ set up the drawer&#039;s list view with items and click listener\r\n\r\n        ActionBar actionBar = getActionBar();\r\n       actionBar.setDisplayHomeAsUpEnabled(true);\r\n        actionBar.setHomeButtonEnabled(true);\r\n\r\n        \/\/ ActionBarDrawerToggle ties together the the proper interactions\r\n        \/\/ between the navigation drawer and the action bar app icon.\r\n        mDrawerToggle = new ActionBarDrawerToggle(\r\n                getActivity(),                    \/* host Activity *\/\r\n                mDrawerLayout,                    \/* DrawerLayout object *\/\r\n                R.string.drawer_open,  \/* &quot;open drawer&quot; description for accessibility *\/\r\n                R.string.drawer_close  \/* &quot;close drawer&quot; description for accessibility *\/\r\n        ) {\r\n            @Override\r\n            public void onDrawerClosed(View drawerView) {\r\n                super.onDrawerClosed(drawerView);\r\n                getActionBar().setIcon(R.drawable.ic_drawer);\r\n\r\n                if (!isAdded()) {\r\n                    return;\r\n                }\r\n\r\n                getActivity().supportInvalidateOptionsMenu(); \/\/ calls onPrepareOptionsMenu()\r\n            }\r\n\r\n            @Override\r\n            public void onDrawerOpened(View drawerView) {\r\n                super.onDrawerOpened(drawerView);\r\n\r\n\r\n                if (!isAdded()) {\r\n                    return;\r\n                }\r\n\r\n\r\n\r\n                getActivity().supportInvalidateOptionsMenu(); \/\/ calls onPrepareOptionsMenu()\r\n            }\r\n        };\r\n\r\n\r\n        \/\/ Defer code dependent on restoration of previous instance state.\r\n        mDrawerLayout.post(new Runnable() {\r\n            @Override\r\n            public void run() {\r\n                mDrawerToggle.syncState();\r\n            }\r\n        });\r\n\r\n        mDrawerLayout.setDrawerListener(mDrawerToggle);\r\n    }\r\n\r\n    private void selectItem(int position) {\r\n        mCurrentSelectedPosition = position;\r\n        if (mDrawerListView != null) {\r\n            mDrawerListView.setItemChecked(position, true);\r\n        }\r\n        if (mDrawerLayout != null) {\r\n            mDrawerLayout.closeDrawer(mFragmentContainerView);\r\n        }\r\n        if (mCallbacks != null) {\r\n            mCallbacks.onNavigationDrawerItemSelected(position);\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void onAttach(Activity activity) {\r\n        super.onAttach(activity);\r\n        try {\r\n            mCallbacks = (NavigationDrawerCallbacks) activity;\r\n        } catch (ClassCastException e) {\r\n            throw new ClassCastException(&quot;Activity must implement NavigationDrawerCallbacks.&quot;);\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void onDetach() {\r\n        super.onDetach();\r\n        mCallbacks = null;\r\n    }\r\n\r\n    @Override\r\n    public void onSaveInstanceState(Bundle outState) {\r\n        super.onSaveInstanceState(outState);\r\n        outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);\r\n    }\r\n\r\n    @Override\r\n    public void onConfigurationChanged(Configuration newConfig) {\r\n        super.onConfigurationChanged(newConfig);\r\n        \/\/ Forward the new configuration the drawer toggle component.\r\n        mDrawerToggle.onConfigurationChanged(newConfig);\r\n    }\r\n\r\n    @Override\r\n    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\r\n        \/\/ If the drawer is open, show the global app actions in the action bar. See also\r\n        \/\/ showGlobalContextActionBar, which controls the top-left area of the action bar.\r\n        if (mDrawerLayout != null &amp;&amp; isDrawerOpen()) {\r\n            inflater.inflate(R.menu.menu_main, menu);\r\n            showGlobalContextActionBar();\r\n        }\r\n        super.onCreateOptionsMenu(menu, inflater);\r\n    }\r\n\r\n    @Override\r\n    public boolean onOptionsItemSelected(MenuItem item) {\r\n        if (mDrawerToggle.onOptionsItemSelected(item)) {\r\n            return true;\r\n        }\r\n\r\n\r\n        return super.onOptionsItemSelected(item);\r\n    }\r\n\r\n    \/**\r\n     * Per the navigation drawer design guidelines, updates the action bar to show the global app\r\n     * &#039;context&#039;, rather than just what&#039;s in the current screen.\r\n     *\/\r\n    private void showGlobalContextActionBar() {\r\n        ActionBar actionBar = getActionBar();\r\n        actionBar.setDisplayShowTitleEnabled(true);\r\n        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);\r\n\r\n    }\r\n\r\n    private ActionBar getActionBar() {\r\n        return ((ActionBarActivity) getActivity()).getSupportActionBar();\r\n    }\r\n\r\n    \/**\r\n     * Callbacks interface that all activities using this fragment must implement.\r\n     *\/\r\n    public static interface NavigationDrawerCallbacks {\r\n        \/**\r\n         * Called when an item in the navigation drawer is selected.\r\n         *\/\r\n        void onNavigationDrawerItemSelected(int position);\r\n    }\r\n}\r\n<\/pre><\/p>\n<h4>SCREENSHOTS<\/h4>\n<p>Here is how the activity screen looks when the drawer is not open.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-2633\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2016\/04\/Screenshot_2016-04-21-16-22-03.png\" alt=\"Screenshot_2016-04-21-16-22-03\" width=\"250\" height=\"444\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2016\/04\/Screenshot_2016-04-21-16-22-03.png 480w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2016\/04\/Screenshot_2016-04-21-16-22-03-300x534.png 300w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>This is how it looks when the drawer opens on tapping the app icon.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-2634\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2016\/04\/Screenshot_2016-04-21-16-22-11.png\" alt=\"Screenshot_2016-04-21-16-22-11\" width=\"254\" height=\"452\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2016\/04\/Screenshot_2016-04-21-16-22-11.png 480w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2016\/04\/Screenshot_2016-04-21-16-22-11-300x534.png 300w\" sizes=\"auto, (max-width: 254px) 100vw, 254px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>The hamburger icon animates to turn into a left arrow. The reverse animation happens when the drawer is closed. If you dont see the icon changing, then make sure that in NavigationDrawerFragment.java\u00a0 you are importing<\/p>\n<pre>import android.support.v7.app.ActionBarDrawerToggle;\r\n<\/pre>\n<p>instead of<\/p>\n<pre>import android.support.v4.app.ActionBarDrawerToggle;<\/pre>\n<p>&nbsp;<\/p>\n<p>The complete source code is <a href=\"http:\/\/www.truelogic.org\/NavigationDrawerTest.zip\" target=\"_blank\">downloadable from this link<\/a>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>OVERVIEW Most modern apps have a sliding Navigation Drawer as the main navigation element. This seems to be the modern version replacement of the sliding <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2016\/04\/21\/create-a-navigation-drawer-in-android\/\" title=\"Create A Navigation Drawer in Android\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":2638,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[295],"tags":[],"class_list":["post-2625","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android-dev"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/2625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=2625"}],"version-history":[{"count":10,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/2625\/revisions"}],"predecessor-version":[{"id":2639,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/2625\/revisions\/2639"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/2638"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=2625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=2625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=2625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}