Note that there are some explanatory texts on larger screens.

plurals
  1. POSlide menu with Expandable listView
    primarykey
    data
    text
    <p>Probably you do not get my question. i made the expandable sliding menu on the main page..now when i open an activity from the expandable sliding menu it works will..but from that opened activity i cant slide my expandable list view which i have on the main page. i want it to be just like a facebook or a gmail but with expandable list..i have chapters and in each chapter i have different topics so if i open on chapter from the expandable list, then i cant direct slide my expandable list from that chapter and for that i have to go back to slide it again. here is my code....``</p> <p>my new adapter</p> <pre><code> package com.example.drawerlayouttest; import java.util.ArrayList; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.TextView; @SuppressWarnings("unchecked") public class NewAdapter extends BaseExpandableListAdapter { public ArrayList&lt;String&gt; groupItem, tempChild; public ArrayList&lt;Object&gt; Childtem = new ArrayList&lt;Object&gt;(); public LayoutInflater minflater; public Activity activity; private final Context context; public NewAdapter(Context context,ArrayList&lt;String&gt; grList, ArrayList&lt;Object&gt; childItem) { this.context = context; groupItem = grList; this.Childtem = childItem; } public void setInflater(LayoutInflater mInflater, Activity act) { this.minflater = mInflater; activity = act; } @Override public Object getChild(int groupPosition, int childPosition) { return null; } @Override public long getChildId(int groupPosition, int childPosition) { return 0; } @Override public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { tempChild = (ArrayList&lt;String&gt;) Childtem.get(groupPosition); TextView text = null; if (convertView == null) { convertView = new TextView(context); } text = (TextView) convertView; text.setText(tempChild.get(childPosition)); text.setPadding(140, 20, 20, 20); text.setTextSize(16); // convertView.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // Toast.makeText(activity, tempChild.get(childPosition), // Toast.LENGTH_SHORT).show(); // } // }); convertView.setTag(tempChild.get(childPosition)); return convertView; } @Override public int getChildrenCount(int groupPosition) { return ((ArrayList&lt;String&gt;) Childtem.get(groupPosition)).size(); } @Override public Object getGroup(int groupPosition) { return null; } @Override public int getGroupCount() { return groupItem.size(); } @Override public void onGroupCollapsed(int groupPosition) { super.onGroupCollapsed(groupPosition); } @Override public void onGroupExpanded(int groupPosition) { super.onGroupExpanded(groupPosition); } @Override public long getGroupId(int groupPosition) { return 0; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { tempChild = (ArrayList&lt;String&gt;) Childtem.get(groupPosition); TextView text = null; if (convertView == null) { convertView = new TextView(context); } text = (TextView) convertView; text.setText(tempChild.get(groupPosition)); text.setPadding(100, 20, 20, 40); text.setTextSize(20); // convertView.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // Toast.makeText(activity, tempChild.get(childPosition), // Toast.LENGTH_SHORT).show(); // } // }); convertView.setTag(tempChild.get(groupPosition)); return convertView; } @Override public boolean hasStableIds() { return false; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return false; } } </code></pre> <p>(Main Activity)</p> <pre><code> package com.example.drawerlayouttest; import java.util.ArrayList; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import android.view.Menu; import android.view.View; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; public class DrawerLayoutTest extends Activity implements OnChildClickListener { private DrawerLayout drawer; private ExpandableListView drawerList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drawer_layout_test); setGroupData(); setChildGroupData(); initDrawer(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.drawer_layout_test, menu); return true; } private void initDrawer() { drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ExpandableListView) findViewById(R.id.left_drawer); drawerList.setAdapter(new NewAdapter(this, groupItem, childItem)); drawerList.setOnChildClickListener(this); } public void setGroupData() { groupItem.add("TechNology"); groupItem.add("Mobile"); groupItem.add("Manufacturer"); groupItem.add("Extras"); } ArrayList&lt;String&gt; groupItem = new ArrayList&lt;String&gt;(); ArrayList&lt;Object&gt; childItem = new ArrayList&lt;Object&gt;(); public void setChildGroupData() { /** * Add Data For TecthNology */ ArrayList&lt;String&gt; child = new ArrayList&lt;String&gt;(); child.add("Java"); child.add("Drupal"); child.add(".Net Framework"); child.add("PHP"); childItem.add(child); /** * Add Data For Mobile */ child = new ArrayList&lt;String&gt;(); child.add("Android"); child.add("Window Mobile"); child.add("iPHone"); child.add("Blackberry"); childItem.add(child); /** * Add Data For Manufacture */ child = new ArrayList&lt;String&gt;(); child.add("HTC"); child.add("Apple"); child.add("Samsung"); child.add("Nokia"); childItem.add(child); /** * Add Data For Extras */ child = new ArrayList&lt;String&gt;(); child.add("Contact Us"); child.add("About Us"); child.add("Location"); child.add("Root Cause"); childItem.add(child); } @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { switch (groupPosition){ case 0: switch (childPosition){ case 0: Intent Intent = new Intent(this,Java.class); startActivity(Intent); break; case 1: Intent Intent1=new Intent(this,Apple.class); startActivity(Intent1); break; case 2: Intent Intent2=new Intent(this,Java.class); startActivity(Intent2); break; case 3: Intent Intent3=new Intent(this,Apple.class); startActivity(Intent3); break; } case 1: switch (childPosition){ case 1: Intent Intent1=new Intent(this,Apple.class); startActivity(Intent1); break; case 2: Intent Intent2=new Intent(this,Java.class); startActivity(Intent2); break; case 3: Intent Intent3=new Intent(this,Apple.class); startActivity(Intent3); break; } return false; } return false; } } </code></pre> <p>(MY XML FILE)</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;!-- The navigation drawer --&gt; &lt;ExpandableListView android:id="@+id/left_drawer" android:layout_width="300dp" android:layout_height="match_parent" android:choiceMode="singleChoice" android:layout_gravity="start" android:background="#6B8E23" android:divider="#272727" android:dividerHeight="0.5dp" /&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload