fragment不走onActivityResult方法的解决

fragment中使用
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
         //处理需要的逻辑
        }
    }

依附的activity中使用
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
           //获取需要的fragment
            List fragments = manager.getFragments();
            MySelfFragment fragment= (MySelfFragment) fragments.get(2);
           //调用fragment中的方法
            fragment.onActivityResult(requestCode,resultCode,data);
        }
    }

你可能感兴趣的:(fragment不走onActivityResult方法的解决)