jfeinstein10 / SlidingMenu

An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!
Apache License 2.0
11.07k stars 5.03k forks source link

Unable to inflate menu #455

Open riyazMuhammad opened 11 years ago

riyazMuhammad commented 11 years ago

Hey Buddy, First of all i would like to thank a billion for this awesome piece of work. Now the issue I have is, in the following piece of code menu.setMenu(R.layout.menu); what ever parameter I pass (R.layout.menu Or even tried with my sample menu as R.menu.sample), it throws this error :( 06-18 18:33:35.183: E/AndroidRuntime(5070): FATAL EXCEPTION: main 06-18 18:33:35.183: E/AndroidRuntime(5070): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sampleApp.android/com.sampleApp.android.DashboardActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class menu

riyazMuhammad commented 11 years ago

Hey I was able to fix this by the following:

  1. do not extend the Activity rather, extend SlidingActivity
  2. replace menu.setmenu(R.layout.menu) to setBehindContentView(R.layout.menu);
  3. SlidingMenu menu = new SlidingMenu() to SlidingMenu menu = getSlidingMenu();

Cheers !

Once again I admire you for awesome piece of work ! :)