1. 程式人生 > >Android中startActivity的起始呼叫過程

Android中startActivity的起始呼叫過程

當我們用Activity的startActivity方法啟動另外一個新的Activity時,起始階段會經過以下幾個方法(從上到下):

    @Override
    public void startActivity(Intent intent) {
        super.startActivity(intent);
    }

    @Override
    public void startActivity(Intent intent, @Nullable Bundle options) {
        super.startActivity(intent, options);
    }

    /**
     * @param requestCode requestCode預設值是-1
     */
    @Override
    public void startActivityForResult(Intent intent, int requestCode) {
        super.startActivityForResult(intent, requestCode);
    }

    @Override
    public void startActivityForResult(Intent intent, int requestCode, @Nullable Bundle options) {
        super.startActivityForResult(intent, requestCode, options);
    }