Multiple MainActivities start on startActivityForResult() in Android
<p>guys,<br>
I've been working on a native Android application for some time and now I am at the end of it there is still a problem I need help with.<br>
<a href="https://github.com/mvelikov/sdiet-android" rel="nofollow">My project at github</a><br>
There is the following problem - when user starts the application for the first time the app will ask him "When does your diet cycle starts?" with a datepicker popup. I am using <strong>SharedPreferences</strong> to store the result user has picked from the popup. I have separate <strong>DatePickerActivity</strong> from the <strong>MainActivity</strong> one that takes care of this datepicker that I start with <strong>startActivityForResult()</strong>. The <strong>DatePickerActivity</strong> passes the result to the <strong>MainActivity</strong> using an <strong>Intent</strong>.<br>
When I debug the app I see <strong>finish()</strong> in <strong>DatePickerActivity</strong> is started twice and the <strong>MainActivity</strong> is started more than one this cause the datepicker popup to show once again.<br>
Once the start date is set in the system there is no problem with these activities and application works fine.<br>
Then comes the moment when user wants to reset the date - using the basket icon with text like "Изчисти" and the datepicker once again appear twice.  </p>

<p>I hope I've been clear enough with my explanation and I am looking fowrard to hearings from you.<br>
Best Regards,<br>
Mihail</p>
