Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As said i'm trying to combine SlidingMenu (https://github.com/jfeinstein10/SlidingMenu) with an ExpandableListView, but i'm having an issue that i don't know how to fix, so i'm hoping some one here can.

I'm currently setting the layout for the menu by 'setMenu(resId)' function, which sets the correct layout for the slide menu, but the problem is that it only sets the XML file layout, which simply includes a and nothing else (So all i get is a white screen).
All other data and settings for the ExpandableListView are set in my SlideMainMenu.java file, but this is never called when setting the XML layout for the slide menu.

So how can i make sure my .java file is called when my XML file is inflated?
It's most likely very easy, but at the moment i just can't seem to figure it out.

I should mention that i'm fairly new to Android/Java, and i'm learning as i go..

setMenu function:

menu.setMenu(R.layout.expand_listview_main);

Start of SlideMainMenu.java

public class SlideMainMenu extends Activity {

    ExpandableListAdapter listAdapter;
    ExpandableListView expandableListView;
    List<String> listDataHeader;
    HashMap<String, List<String>> listDataChild;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.slide_left_main_menu);

        Toast.makeText(getParent(), "SlideMenuInit success", Toast.LENGTH_LONG).show(); // TEST

        expandableListView = (ExpandableListView) findViewById(R.id.ExpandableListView_Main);
        prepareListData();
        listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
        expandableListView.setAdapter(listAdapter);
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.