When I change orientation application restarts and I lost my current data.. I am using activity group which contain lots of activities when i change orientation application
This is how it's supposed to work. There's a way to make it not do that, but you should be following the lifecycle and be able to handle activity restarts gracefully. This has been asked here many times.
There is some good information in the API documentation on why the current Activity gets destroyed and rebuilt. I found it to be very enlightening the last time I worked on something related.
Unless you specify otherwise, a configuration change (such as a change in screen orientation[...]) will cause your current activity to be destroyed, going through the normal activity lifecycle process of onPause(), onStop(), and onDestroy() as appropriate. If the activity had been in the foreground or visible to the user, once onDestroy() is called in that instance then a new instance of the activity will be created, with whatever savedInstanceState the previous instance had generated from onSaveInstanceState(Bundle).
http://developer.android.com/reference/android/app/Activity.html#ConfigurationChanges
if your android:targetSdkVersion="12" or less
android:configChanges="orientation|keyboardHidden">
if your android:targetSdkVersion="13" or more
android:configChanges="orientation|keyboardHidden|screenSize">
You could tell the system to ignore the changes with the following:
<activity android:name="SomeActivity" android:configChanges="keyboardHidden|orientation">
but I would suggest not doing that because this is often an indication of underlying problems that are yet to emerge.
My advice is that you simply add a new class that will handle resuming of all long operations or any activity modifications.
Android restarts the activities whenever the orientation change by default.
You will need to save your data/state by calling onSaveInstanceState()
before Android destroys the activities.
Have a look here: Handling Runtime Changes
This SO question also proves to be a good read in understanding how you could deal with it.
You could prevent this by adding android:configChanges="orientation"
to your activity in AndroidManifest file.
Source: http://developer.android.com/guide/topics/manifest/activity-element.html#config