title: Android app null error
body: <p>I am creating a restaurant app that requires an expandable listview to show a menu for the waiter to take a customer's menu. The app is crashing and I think it has something to do with the code below:</p>
  
  <pre><code>public class Menu extends AppCompatActivity {
  
       HashMap &lt; String, List &lt; String &gt;&gt; Food_menu;
       List &lt; String &gt; Food_list;
       ExpandableListView Exp_list;
       FoodMenuAdapter adapter;
  
       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);
  
           Exp_list = (ExpandableListView) findViewById(R.id.exp_list);
           Food_menu = DataProvider.getInfo();
           Food_list = new ArrayList &lt; String &gt; (Food_menu.keySet());
           adapter = new FoodMenuAdapter(this, Food_menu, Food_list);
           Exp_list.setAdapter(adapter);
  
  
       }
   }
  </code></pre>
  
  <p>When I debugged the app, it said that:</p>
  
  <pre><code>Exp_list
  Food_menu
  Food_list 
  </code></pre>
  
  <p>were all coming back as null. I'm new to android studios and I'm not sure how to remedy the problem. Any help would be greatly appreciated, thanks.</p>
  
  <p>Logcat:</p>
  
  <pre><code>04-11 22:05:53.841 1960-1960/com.example.ben.restaurantapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.example.ben.restaurantapp, PID: 1960
                                                                           java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ben.restaurantapp/com.example.ben.restaurantapp.Menu}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ExpandableListView.setAdapter(android.widget.ExpandableListAdapter)' on a null object reference
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
                                                                               at android.app.ActivityThread.access$800(ActivityThread.java:144)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:135)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5221)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at java.lang.reflect.Method.invoke(Method.java:372)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
                                                                            Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ExpandableListView.setAdapter(android.widget.ExpandableListAdapter)' on a null object reference
                                                                               at com.example.ben.restaurantapp.Menu.onCreate(Menu.java:38)
                                                                               at android.app.Activity.performCreate(Activity.java:5937)
                                                                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
                                                                               at android.app.ActivityThread.access$800(ActivityThread.java:144) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:135) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5221) 
                                                                               at java.lang.reflect.Method.invoke(Native Method) 
                                                                               at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
  </code></pre>