Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ADB - bring window back to top

Tags:

android

adb

Say I have 2 apps A & B running. A got pushed back after B was clicked, so B was on top of A making A invisible.

How do I bring A back to the top/front using adb commands?

It might has something to do with FocusedWindow or something but I'm not sure.

If you launch that app again using am, previous activities may be terminated causing problems or worse, a new instance maybe started (I'm not sure if that's the case). To put it in plain terms, I don't want to restart A nor do I want to lose any changes made in A, so A must be brought back to top/front instead of restarted.

like image 464
AsianRyanReynolds Avatar asked Oct 15 '25 20:10

AsianRyanReynolds


1 Answers

If you know the app's package name and activity, then try following command

adb shell am start --activity-single-top com.package.your_app/.YourActivity

--activity-single-top flag will make sure that activity which needs to be started if happens to be the app's foreground activity, then it will be resumed.

like image 185
Binary Baba Avatar answered Oct 18 '25 14:10

Binary Baba



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!