Q: Null Pointer during orientation change on DrawerLayout I have this weird scenario wherein after the onOrientationChange I got a Null Pointer Error, my  DrawerLayout that has been initialized on onCreateView before the change. 
mDrawerLayout = (DrawerLayout) rootView.findViewById(R.id.drawer_layout);

And I am getting null on this point,
 if(mDrawerList.getChildAt(position)!=null){
 }


private void selectItem(int position, boolean InstanceStateNull) {
         Log.d("selectItem", "inside");

        //savePosition("position", position);
           // update the main content by replacing fragments
        Toast.makeText(getActivity(), "SELECT ITEM: "+ position, Toast.LENGTH_SHORT).show();
        Log.d("SELECT ITEM: Position: ", ""+ position);

        this.mDrawerList.setItemChecked(position, true);
        this.mDrawerList.setSelection(position);

        String selectedPid = null;
        //use mDrawerList.getChildAt(position) for not having null pointer
         if(mDrawerList.getChildAt(position)!=null)
         {
             //Extracts the string 
            TextView pid = (TextView)mDrawerList.getChildAt(position).findViewWithTag("pid");
            selectedPid =  pid.getText().toString(); 
            Log.d("SELECT ITEM: SELECTED ITEM: ", ""+ selectedPid.toString());
            Toast.makeText(getActivity(), "SELECTED ITEM: "+ selectedPid
                     , Toast.LENGTH_SHORT).show();
            //saveSelecteditem("selectedItem", selectedPid);

         }
         else{
             Log.i("DrawerList on Orientation Change: ", "Null");
             //Log.i("DrawerList on Orientation Change: ", "Count" + mDrawerList.getAdapter().getCount());

         }
           }

Update: 
I am not and will not be using the configChanges, I am handling the orientation change manually. Thanks

A: Try this in your manifest...
<activity android:name="Your Activity Name"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:windowSoftInputMode="adjustPan"/>

