I have one android application which has Main Activity.
If we insert wireless USB mouse - Activity restart lifecycle callbacks are getting triggered from android framework. (Like, onPause - onStop - onDestroy - onCreate - onStart - onResume).
But, If we insert wired USB mouse - Activity is not restarting.
How to prevent activity restart cycle on inserting wireless USB mouse,keyboard etc ??
Using wireless mouse causes activity to recreate. Adding navigation in configChanges solves the problem.
<activity
...
android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation"
/>
Now try to insert/remove Bluetooth mouse/keyboard etc. Activity wont recreate.