First of all, don't use am.  All it does is call startActivity() from its
own environment, so you have just made things 10x harder for yourself,
impossible to actually integrate with your UI flow, likely to break in the
future, and not gotten to do anything more than startActivity() does.
Second, when you start an activity, it starts out at the top of its stack,
and its window has focus.  You don't need to do anything special.  I don't
know what you are doing to cause this behavior, but simply calling
startActivity() from your own activity will work.

Third, please be sure you read the application fundamentals documentation:
http://developer.android.com/guide/topics/fundamentals.html

On Sun, Sep 13, 2009 at 3:31 AM, HandsomeboyIT <[email protected]>wrote:

>
> hi all,
> Can anybody show me how to switch to another Android application
> programmatically  or request focus on a specific application? My
> situation is that, I have an Activity, and in that activity, I start
> other UI application by "am" command. When the program runs, it float
> to top screen, but it don't have focus. I need to focus to that
> application's screen programmatically  for doing some automatic
> action. How can I do this?
>
> Thanks so much.
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to