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: 
If currently visible activity is from the library, and you can not edit the code for it, then it is not possible to handle the backpress of the activity. However, If you are calling this library activity with an `Intent` from your Activity, What you can do is,  

Write a class that `extends LibraryActivity` and call this activity instead. There you can override the `onBackPressed()` method.
Just make library activity `android:noHistory="true"` in manifest. And save data you require some where else.