title: Get the Application Context In Fragment In Android?
body: <p>I have stored some data to a Global Class By using the Application Context In One Activity. Later I have to Retrieve those values in A Fragment. I have done something like this to store in Global Class.</p>
  
  <pre><code>AndroidGlobalClass  AGC = ((AndroidGlobalClass) getApplicationContext());
  AGC.setUser_access("XYZ");
  AGC.setFirst_name("ABC");
  </code></pre>
  
  <p>And In the Manifest I have done :</p>
  
  <pre><code>&lt;application
      android:name=".AndroidGlobalClass"
      android:theme="@style/AppTheme" &gt;
      &lt;activity
         android:name="abc.SignInActivity"
         android:label="@string/app_name" &gt;
         &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
         &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>Now When I am Trying to Get the Application Context Using this... I am not getting the Context...</p>
  
  <pre><code>AndroidGlobalClass  AGC = ((AndroidGlobalClass) getApplicationContext());
  </code></pre>
  
  <p>This is My Fragment Activity </p>
  
  <pre><code>public class Fragment_NewsFeed extends Fragment {
      public Fragment_NewsFeed() {
      }
  
      RestImplimentationMethods RIM;
      AndroidGlobalClass AGC;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.fragment_newsfeed, container, false);
          return rootView;
      }
  }
  </code></pre>