Sorry you can't do this.  UI flow is tied to activities, so you really need
to make the call from there.  If you hack things up to be able to poke the
window manager like that from elsewhere, you won't be doing it from the
actual UI flow so in some cases will not be properly synchronized with it so
have incorrect results.

On Thu, Jul 8, 2010 at 6:25 PM, QasewKim <[email protected]> wrote:

> Hi,
>
> I am beginner with Android(and java).
> I am trying to make UI using Service. (which has view or viewgroup.)
> And I need the Transition Effect when I start the Activity from this
> Service.
>
> 1.
> so I did something below.
>
> =======================================
> public class Myservice extends Service {
>
>    @Override
>    public IBinder onBind(Intent intent) {
>            return s;
>    }
>
>    private Myservice .Stub s = new Myservice .Stub(){
>        @Override
>
>    public void StartActivity() throws RemoteException {
>        Intent intent = new Intent(Intent.ACTION_VIEW);
>                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>                startActivity(intent);
>                overridePendingTransition (R.anim.left, R.anim.right)  //
> can't compile
>        }
> =======================================
> It failed.
> only SomeActivity (that extends Activity) can call
> overridePendingTransition(),
> but Service can't.
>
>
> 2.
> So I try this.
> =======================================
> ...
> private StartActivityImpl  StartActivityImpl ;
>
>  public void StartActivity() throws RemoteException {
>        Intent intent = new Intent(Intent.ACTION_VIEW);
>                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>                startActivity(intent);
>                StartActivityImpl.StartactwithTransition();
>        }
>
>    };
>    private class StartActivityImpl extends Activity {
>
>        public void StartactwithTransition(){
>                overridePendingTransition(R.anim.left , R.anim.right ); //
> complie ok
>        }
> =======================================
> It also failed.
> I don't know why. (can you tell me why?)
>
>
> 3.
> is it possible to add the code within Service.java like Activity.java
> below?
> =======================================
> Activity.java
> ..
>    public void overridePendingTransition(int enterAnim, int exitAnim)
> {
>        try {
>
> ActivityManagerNative.getDefault().overridePendingTransition(
>                    mToken, getPackageName(), enterAnim, exitAnim);
>        } catch (RemoteException e) {
>        }
>    }
> =======================================
> Service.java has mToken, too.
>  and it can call getPackageName();
> so can I add this function to Service.java?
>
>
> 4.
> or is it good way to use ActivityManagerNative, IActivityManager in
> MyService?
> ( import ActivityManagerNative, IActivityManager
> and call ActivityManagerNative.getDefault().overridePendingTransition(
> and build internally using Android.mk)
>
>
>
> 5.
> So my question is " How can i start activity with Transition Effect
> from Service?"
> If I have to modify the frameworks, I'll do that.
>
> I don't care about modifying the frameworks,
> so please give me your good tips (even though) in the view of a
> platform developer.
> I hope you help me!
>
> Thanks!
>
>
> --
> unsubscribe: 
> [email protected]<android-porting%[email protected]>
> website: http://groups.google.com/group/android-porting
>



-- 
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.

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to