Fix problems overridePendingTransition VerifyError effect occurs in 1.6 version

overridePendingTransition This function was added to it after API5, then we will certainly want to write:

if(android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.DONUT) {
  overridePendingTransition(0,0);
}


Well Well I take it for granted that doing so does not run up on business results in the 1.6 machine. . . . VerifyError. . . .

Why is this? Obviously if the statement does not run ah ~

wrong! overridePendingTransition invoked when loading the class loader, so regardless of if ~ then you write do not write in it will be executed if the bug occurs

How to solve it?

OK let him run when loading Jiuhaola ~

Placed inside a class ~ call ~ in the inner classes

if(android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.DONUT) {
    newObject() {
 
      publicvoid overridePendingTransition(Activity c, inti, intj) {
          c.overridePendingTransition(i,j);
      }
    }.overridePendingTransition(this,0,0);
}



So before running if internal class method will not be loaded into the JVM then it will not be called inside the ~

OK resolve ~

Reproduced in: https: //my.oschina.net/lendylongli/blog/226789

Guess you like

Origin blog.csdn.net/weixin_33704234/article/details/92576464