title: How to use StartActivityForResult for fragments?
body: <p>Currently I am using fragments in my project. But for search screen alone I am using separate Activity. I am try to convert that activity to fragment. My problem is currently I I am call the search activity from fragment like </p>
  
  <pre><code>private void callLocationSearch() {
          Intent intent = new Intent(activity, SearchDataFilterActivity.class);
          intent.putExtra(Constants.RECEIVE_INTENT_DATA, activity.getResources().getString(R.string.location));
          startActivityForResult(intent, FOR_SEARCH_LOCATION);
      }
  </code></pre>
  
  <p>From Search screen  I set result and send to the previous screen.</p>
  
  <pre><code>setResult(Activity.RESULT_OK, returnIntent);
  finish();
  </code></pre>
  
  <p>So that in <code>onActivityResult</code> I get the the result and set in the search field. I have multiple fields in this screen. So I search from the search activity and set in this fragment. Now I changed Search activity to Fragment. The problem is I am not able to do setResult and send back to fragment. I can only to create another fragment and pass the values. So that the previous values are getting loss. Please let me any idea to solve my issue.</p>
  
  <p>Herewith I attached the screenshots:</p>
  
  <p>First one is fragment
  <a href="https://i.stack.imgur.com/bTFP9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bTFP9.png" alt="Fragment Image"></a></p>
  
  <p>Second one is Search Activity. 
  <a href="https://i.stack.imgur.com/KAU9M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KAU9M.png" alt="Activity"></a></p>
  
  <p>For More clarification I attached one more image.
  <a href="https://i.stack.imgur.com/qeJZw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qeJZw.jpg" alt="enter image description here"></a></p>