调用injectkeyevent,插入home键事件,键值为3

解决方案 »

  1.   

        startActivity的源码,看看有用没    @Override
        public void startActivity(Intent intent) {
            startActivityForResult(intent, -1);
        }
        public void startActivityForResult(Intent intent, int requestCode) {
            if (mParent == null) {
                Instrumentation.ActivityResult ar =
                    mInstrumentation.execStartActivity(
                        this, mMainThread.getApplicationThread(), mToken, this,
                        intent, requestCode);
                if (ar != null) {
                    mMainThread.sendActivityResult(
                        mToken, mEmbeddedID, requestCode, ar.getResultCode(),
                        ar.getResultData());
                }
                if (requestCode >= 0) {
                    // If this start is requesting a result, we can avoid making
                    // the activity visible until the result is received.  Setting
                    // this code during onCreate(Bundle savedInstanceState) or onResume() will keep the
                    // activity hidden during this time, to avoid flickering.
                    // This can only be done when a result is requested because
                    // that guarantees we will get information back when the
                    // activity is finished, no matter what happens to it.
                    mStartedActivity = true;
                }
            } else {
                mParent.startActivityFromChild(this, intent, requestCode);
            }
        }
      

  2.   

    关键你frawork中哪部分去执行,如果是一个service的话,获取context就好了,如果只是接口的话只能应用提供context了
      

  3.   

    解决方法:
    http://hi.baidu.com/wishwingliao/blog/item/8364211fcdb462d9a78669de.html