title: how to update listview on backpressed in nested fragment?
body: <p>This is my Fragment where I have a list view and I am populating it with ChapterListAdapter.</p>
  
  <p><strong>Curriculum Fragment</strong></p>
  
  <pre><code>    public class CurriculumFragment extends Fragment implements 
  ResponseDelegate {
          Context contextd;
          ListView curriculumList;
          FragmentActivity mActivity;
          boolean onResult=false;
          int requestCode, resultCode;
          Intent data;
          String courseId;
          private RequestedServiceDataModel requestedServiceDataModel;
          private ArrayList&lt;ChapterItem&gt; courses = new ArrayList&lt;&gt;();
          private ChaptersListAdapter adapter;
  
          @Nullable
          @Override
          public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
              contextd = container.getContext();
              View rootView = inflater.inflate(R.layout.fragment_circulam, container, false);
              courseId = getArguments().getString("course_id","2");
              curriculumList = (ListView) rootView.findViewById(R.id.circulamList);
              adapter = new ChaptersListAdapter((AppCompatActivity) getActivity(), courses);
              curriculumList.setAdapter(adapter);   
              serverRequestForCompleteModule();  // This function fill arraylist courses with data.
              return rootView;
          }
          @Override
          public void onAttach(Activity activity) {
          super.onAttach(activity);
          mActivity = (FragmentActivity) activity;
          }
  
          @Override
          public void onDetach() {
          super.onDetach();
          contextd = null;
          mActivity = null;
          }
  
          @Override
          public void onActivityResult(int requestCode, int resultCode, Intent 
  data) {
          super.onActivityResult(requestCode, resultCode, data);
          if(resultCode == getActivity().RESULT_OK &amp;&amp; requestCode == 1111)
          {
          courses.clear();
          courses = (ArrayList&lt;ChapterItem&gt;) data.getSerializableExtra("list");
          adapter = new ChaptersListAdapter((AppCompatActivity)mActivity, 
  courses);
          curriculumList.setAdapter(adapter);
          }
      }
  </code></pre>
  
  <p>OnItemclick of ChapterListAdapter I am opening Activity MediaplayerActivity3 like this</p>
  
  <p><strong>ChapterListAdapter</strong></p>
  
  <pre><code>     void dialogMediaPlayer(final ArrayList&lt;ChapterItem.Module&gt; mlist, final int position, String title, String imageUrl,String chapname,boolean audioStream) {
  
          Intent mint = new Intent(contextd, MediaPlayerActivity3.class);
          Bundle bundle = new Bundle();
          bundle.putSerializable("courselist",list);
          bundle.putSerializable("list",mlist);
          bundle.putInt("gpos",glPos);
          bundle.putInt("pos",position);
          bundle.putString("title",title);
          bundle.putString("image",imageUrl);
          bundle.putString("chapter",chapname);
          bundle.putBoolean("stream",audioStream);
          mint.putExtras(bundle);
          contextd.startActivityForResult(mint,1111);
          contextd.overridePendingTransition( R.anim.slide_up, R.anim.slide_down );
  }
  </code></pre>
  
  <p>Now I do My work In Activity and Now when I backpress I want to update listView in Curriculum Fragment, which I am doing through OnActivityResult method but in onActivityResult method  getActivity() always return null.</p>
  
  <p>Onbackpressedmethod in Activity is as follows</p>
  
  <p><strong>MediaPlayerActivity3</strong></p>
  
  <pre><code>public class MediaPlayerActivity3 extends AppCompatActivity implements ResponseDelegate {
                 @Override
  public void onBackPressed() {
      saveInsatance(tmpModule.get(position).getModule_id());
      stop = false;
      myHandler.removeCallbacks(UpdateSongTime);
  
      int x1=0;
      if(tmpModule.get(posit).getIs_module_comeplete().equals("0")){
          x1=(int)(TimeUnit.MILLISECONDS.toSeconds((long)finalTime)-TimeUnit.MILLISECONDS.toSeconds((long)startTime));
          if(x1&lt;5){
              serverRequestQuizForAudeoComplite(tmpModule.get(posit).getModule_id());
              tmpModule.get(posit).setIs_module_comeplete("1");
  
          }
      }
      courses.get(glpos).setModule_files(tmpModule);
      Intent returnIntent = new Intent();
      Bundle bundle = new Bundle();
      bundle.putSerializable("list",courses);
      bundle.putString("complete",completed);
      returnIntent.putExtras(bundle);
      setResult(Activity.RESULT_OK,returnIntent);
      super.onBackPressed();
   }
  }
  </code></pre>