Android技巧

ClassNotFoundException——Android史

2019-03-14  本文已影响0人  melloyy

问题来源:

同一款app 同一个点击 在某些机器上报classnotfoundexception 不同机器上报的找不到的类千奇百怪 还有机型报错是Activity could not be started for Intent  某些机器一切正常 

经过n小时的奋战发现


' /**

    * Modifies the standard behavior to allow results to be delivered to fragments.

    * This imposes a restriction that requestCode be <= 0xffff.

    */

    @Override

    public void startActivityForResult(Intent intent, int requestCode) {

        // If this was started from a Fragment we've already checked the upper 16 bits were not in

        // use, and then repurposed them for the Fragment's index.

        if (!mStartedActivityFromFragment) {

            if (requestCode != -1) {

                checkForValidRequestCode(requestCode);

            }

        }

        super.startActivityForResult(intent, requestCode);

    }

    @Override

    public void startActivityForResult(Intent intent, int requestCode,

            @Nullable Bundle options) {

        // If this was started from a Fragment we've already checked the upper 16 bits were not in

        // use, and then repurposed them for the Fragment's index.

        if (!mStartedActivityFromFragment) {

            if (requestCode != -1) {

                checkForValidRequestCode(requestCode);

            }

        }

        super.startActivityForResult(intent, requestCode, options);

    }

'


千万不要用startActivityForResult(Intent intent, int requestCode, @Nullable Bundle options) 方法

上一篇下一篇

猜你喜欢

热点阅读