title: unable to instantiate activity component info:nullpointerexception
body: <p>I am getting unable to instantiate activity component info: mainactivity:NullPointerException
  My first screen is a splash screen which passes data to main activity.The main activity passes the data to its fragments. This data is used to load the spinner dropdown. The code was working previously when the internet access was done in fragment. Thus, when each time the fragment was selected data was retrieved from server to load the dropdown. But now I simply took the data from server during intial splash screen using async task and passed it via intent to main activity. Using functions like getDepartment() the fragment can access the string.</p>
  
  <pre><code>    FragmentTab1.java
      @Override
      public SherlockFragmentActivity getSherlockActivity() {
          return super.getSherlockActivity();
      }
  
      @Override
      public void onViewCreated(View view, Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          // Get the view from fragmenttab1.xml
          View view = inflater.inflate(R.layout.fragmenttab1, container, false);
  
  
  
  
          final Spinner spinner1 = (Spinner) view.findViewById(R.id.Spinner1);
            // Spinner click listener
        spinner1.setOnItemSelectedListener(this);
         // Spinner Drop down elements
        List&lt;String&gt; categories = new ArrayList&lt;String&gt;();
        categories.add("select");
  
  
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
          //MainActivity x=new MainActivity();
  
  
  
          try {
              // dept_response = CustomHttpClient.executeHttpPost("http://10.0.2.2/android_db/ppf4_dept.php",response_Parameters);
              //dept_response = CustomHttpClient.executeHttpPost("http://webdev1.tifr.res.in/~PFproj/pplf/ppf4_dept.php",response_Parameters,FragmentTab1.this.getActivity());
              String dept_result=((MainActivity)this.getActivity()).getDepartment();
          JSONArray jArray = new JSONArray(dept_result);
            for(int i=0;i&lt;jArray.length();i++){
                  JSONObject json_data = jArray.getJSONObject(i);
  
  
                  //categories.add(json_data.getString("dept"));}
                  categories.add(json_data.getString("PF_dept"));}
  
  
          }
          catch(JSONException e){
              Log.e("log_tag", "Error parsing data "+e.toString());
      }
          catch (Exception e) {
               Log.e("log_tag","Error in http connection!!" + e.toString());     
              }
  
  
  
  
          // Creating adapter for spinner
          ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String&gt;(this.getActivity(), android.R.layout.simple_spinner_item, categories);
          // Drop down layout style - list view with radio button
          dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          // attaching data adapter to spinner
          spinner1.setAdapter(dataAdapter);
  
  
  
          final Spinner spinner2 = (Spinner) view.findViewById(R.id.Spinner2);
            // Spinner click listener
        spinner2.setOnItemSelectedListener(this);
        // Spinner Drop down elements
        List&lt;String&gt; categories2 = new ArrayList&lt;String&gt;();
        categories2.add("select");
  
       // ArrayList&lt;NameValuePair&gt; response_Parameters = new ArrayList&lt;NameValuePair&gt;();
  
          try {
               //role_response = CustomHttpClient.executeHttpPost("http://10.0.2.2/android_db/ppf4_role.php",response_Parameters);
              //role_response = CustomHttpClient.executeHttpPost("http://webdev1.tifr.res.in/~PFproj/pplf/ppf4_role.php",response_Parameters,FragmentTab1.this.getActivity());
              String role_result=((MainActivity)this.getActivity()).getRole();
  
          JSONArray jArray = new JSONArray(role_result);
            for(int i=0;i&lt;jArray.length();i++){
                  JSONObject json_data = jArray.getJSONObject(i);
  
  
                  categories2.add(json_data.getString("role"));}
  
          }
          catch(JSONException e){
            Log.e("log_tag", "Error parsing data "+e.toString());
    }
          catch (Exception e) {
               Log.e("log_tag","Error in http connection!!" + e.toString());     
              }
  
  
        // Creating adapter for spinner
          ArrayAdapter&lt;String&gt; dataAdapter2 = new ArrayAdapter&lt;String&gt;(this.getActivity(), android.R.layout.simple_spinner_item, categories2);
          // Drop down layout style - list view with radio button
          dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          // attaching data adapter to spinner
          spinner2.setAdapter(dataAdapter2);
  
  
  
  
          //spinner3
          final Spinner spinner3 = (Spinner) view.findViewById(R.id.Spinner3);
            // Spinner click listener
        spinner3.setOnItemSelectedListener(this);
        // Spinner Drop down elements
        List&lt;String&gt; categories3 = new ArrayList&lt;String&gt;();
        categories3.add("select");
  
        String desig_response = null;
          try {
               //desig_response = CustomHttpClient.executeHttpPost("http://10.0.2.2/android_db/ppf4_desig.php",response_Parameters);
              //desig_response = CustomHttpClient.executeHttpPost("http://webdev1.tifr.res.in/~PFproj/pplf/ppf4_desig.php",response_Parameters,FragmentTab1.this.getActivity());
              String desig_result=((MainActivity)this.getActivity()).getDesignation();
  
          JSONArray jArray = new JSONArray(desig_result);
            for(int i=0;i&lt;jArray.length();i++){
                  JSONObject json_data = jArray.getJSONObject(i);
  
                 // String name=json_data.getString("dept");
                  categories3.add(json_data.getString("designation"));}
  
          }
          catch(JSONException e){
          Log.e("log_tag", "Error parsing data "+e.toString());
  }
          catch (Exception e) {
               Log.e("log_tag","Error in http connection!!" + e.toString());     
              }
  
        // Creating adapter for spinner
          ArrayAdapter&lt;String&gt; dataAdapter3 = new ArrayAdapter&lt;String&gt;(this.getActivity(), android.R.layout.simple_spinner_item, categories3);
          // Drop down layout style - list view with radio button
          dataAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          // attaching data adapter to spinner
          spinner3.setAdapter(dataAdapter3);
  </code></pre>
  
  <p>MainActivity</p>
  
  <pre><code>    public class MainActivity extends SherlockFragmentActivity implements
      SearchView.OnQueryTextListener, SearchView.OnSuggestionListener {
  //***********************************************************************************************************
  
  // start of actionbarsherlock tabnavigation
  // Declare Variables
  ActionBar mActionBar;
  ViewPager mPager;
  Tab tab;
  DBController controller = new DBController(this);
  Intent i = getIntent();
  String dept_response = i.getExtras().getString("dept_response");
  String role_response = i.getExtras().getString("role_response");
  String desig_response = i.getExtras().getString("desig_response");
  public String getDepartment(){
         return this.dept_response;
       }
  public String getRole(){
         return this.role_response;
       }
  public String getDesignation(){
         return this.desig_response;
       }
  
  
  ArrayList&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  </code></pre>
  
  <p>logcat:</p>
  
  <pre><code>01-28 22:24:09.623: D/AndroidRuntime(1123): Shutting down VM
  01-28 22:24:09.623: W/dalvikvm(1123): threadid=1: thread exiting with uncaught exception (group=0x40015560)
  01-28 22:24:09.663: E/AndroidRuntime(1123): FATAL EXCEPTION: main
  01-28 22:24:09.663: E/AndroidRuntime(1123): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.tab/com.example.tab.MainActivity}: java.lang.NullPointerException
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.os.Handler.dispatchMessage(Handler.java:99)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.os.Looper.loop(Looper.java:123)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.app.ActivityThread.main(ActivityThread.java:3683)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at java.lang.reflect.Method.invokeNative(Native Method)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at java.lang.reflect.Method.invoke(Method.java:507)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at dalvik.system.NativeStart.main(Native Method)
  01-28 22:24:09.663: E/AndroidRuntime(1123): Caused by: java.lang.NullPointerException
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at com.example.tab.MainActivity.&lt;init&gt;(MainActivity.java:49)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at java.lang.Class.newInstanceImpl(Native Method)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at java.lang.Class.newInstance(Class.java:1409)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
  01-28 22:24:09.663: E/AndroidRuntime(1123):     ... 11 more
  01-28 22:24:15.943: I/Process(1123): Sending signal. PID: 1123 SIG: 9
  </code></pre>