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]
website: http://groups.google.com/group/android-porting

Reply via email to