Android RUNTIME: FATAL exception java.lang.NullPointerException
<p>I know there is already solution regarding this topic but I have been unsuccessful in fixing the issue. 
I am new to android and also new to this group. I am trying to implement the spinner in <code>onCreateView()</code> method. I followed this tutorial <a href="https://developer.android.com/guide/topics/ui/controls/spinner.html" rel="nofollow noreferrer">Android developers</a><br>
But when I run this app in AVD it suddenly stops and close the app.<br>
Please help me to fix the issue.<br>
This is my java <b>Code</b><br></p>

<pre><code>import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;

import static android.R.layout.simple_spinner_dropdown_item;
import static android.R.layout.simple_spinner_item;

public class edit_information extends Fragment implements AdapterView.OnItemSelectedListener {
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstaceState){
        Spinner spinner = (Spinner) getActivity().findViewById(R.id.spinner1);
        //Creating an array adapter using the string array and a default spinner layout
        ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(getContext(),R.array.hall_type,simple_spinner_item);

        //Layout to choose the dropdown list
        adapter.setDropDownViewResource(simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
        spinner.setOnItemSelectedListener(this);
        return inflater.inflate(R.layout.edit_information,container,false);
    }

    @Override
    public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
        Toast.makeText(adapterView.getContext(),"Hall Selected: \n"+adapterView.getItemAtPosition(i).toString(),Toast.LENGTH_LONG).show();
    }

    @Override
    public void onNothingSelected(AdapterView&lt;?&gt; adapterView) {

    }
}
</code></pre>

<p>Here is the logcat file <b>error</b><br></p>

<pre><code>FATAL EXCEPTION: main
Process: com.example.lokesh.eveapp, PID: 18424
java.lang.NullPointerException
   at com.example.lokesh.eveapp.edit_information.onCreateView(edit_information.java:27)
   at android.support.v4.app.Fragment.performCreateView(Fragment.java:2087)
   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1113)
   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1295)
   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
   at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1643)
   at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:679)
   at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
   at android.support.v4.view.ViewPager.populate(ViewPager.java:1272)
   at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:672)
   at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:634)
   at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:615)
   at com.example.lokesh.eveapp.Member_Activity.onTabSelected(Member_Activity.java:81)
   at android.support.design.widget.TabLayout.dispatchTabSelected(TabLayout.java:1154)
   at android.support.design.widget.TabLayout.selectTab(TabLayout.java:1147)
   at android.support.design.widget.TabLayout.selectTab(TabLayout.java:1117)
   at android.support.design.widget.TabLayout$Tab.select(TabLayout.java:1412)
   at android.support.design.widget.TabLayout$TabView.performClick(TabLayout.java:1520)
   at android.view.View$PerformClick.run(View.java:18568)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5021)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
   at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>Logcat says NullPointerException on line 27 this is the code on line 27<br></p>

<pre><code>spinner.setAdapter(adapter);
</code></pre>

<p>Kindly help.<br>
Thank you</p>