0

Given that I have the process id of another independent process or application, how can I switch to it and give it the focus from my application?

I can't seem to find a reference to this but I know it can be done as an app named OS Monitor allows me to do it as do other apps.

Regards, Jim

user1047857
  • 133
  • 1
  • 11

2 Answers2

0

Your question is a bit confusing, how I took it is that you want to switch views to another page The following code will load a GUI into an Intent (Put this in your MainActivity.java):

Intent yourIntent = new Intent(MainActivity.this, OtherActivity.class);

This will have the Intent run:

startActivity(yourIntent);

If this isn't what you meant, please clarify your question :)

Carter Brainerd
  • 199
  • 2
  • 10
  • In Application A I want to relinquish control and switch the control/focus to Application B given that I have the PID for Application B. The Android app "OS Monitor" allows the user t do this with a button on the process list. Note both Applications are active and they are unrelated – user1047857 Sep 11 '16 at 01:23
  • oh okay i understand now. i'll work on the answer when i get home :) – Carter Brainerd Sep 11 '16 at 01:24
  • okay I think I found what you're looking for [here](http://stackoverflow.com/questions/8091350/how-to-find-the-currently-running-applications-programatically-in-android) – Carter Brainerd Sep 11 '16 at 06:11
0

Call any method which contains any process which you want to implement.

Otherwise, clarify your question.

Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
Ravi.Sh
  • 187
  • 2
  • 6