title: Use onactivityresult android
body: <p>I want to call a method from <code>mainactivity</code> in other activities. For that, I've researched a lot and found that using <code>OnActivityResult</code> is the best option. Can anyone please explain how to use this method with the help of an example? I've gone through similar questions but found them confusing.
  Thanks!</p>
  
  <p>EDIT:I have a custom dialog activity in my app. It asks the users whether they want to start a new game or not and it has two buttons yes and no. I want to implement the above method only to get the pressed button.  </p>