Question: There is a android library. workflow like that:

> 
> A1->A2-A3->Library activity->A3
> 
> 
> 

I need to hide library activity when user click physical `back button`.
Also, the library activity saved some data, so that I cannot `destroy` or `finish()` the library activity.

> 
> A1->A2->A3->lib--->return to previous A3
> 
> 
> 

If user press `back button`, I want to skip the `library` activity and jump to `A2` from `A3` but not destroy the library activity because the library activity saved data that I need to use it again.

Answer: 
You should override `onBackPressed` method in your activity like this:

```
@Override
public void onBackPressed() {
   super.onBackPressed();
 //change your View from A3 to A2 
}

```

You can save data using `SharedPreferences`.
Just make library activity `android:noHistory="true"` in manifest. And save data you require some where else.