Created
September 11, 2019 06:46
-
-
Save zi6xuan/854cef6dc3335f470a9ec45cb494e643 to your computer and use it in GitHub Desktop.
Fix the VideoView memory leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void attachBaseContext(Context newBase) { | |
super.attachBaseContext(new ContextWrapper(newBase){ | |
@Override | |
public Object getSystemService(String name) { | |
if(Context.AUDIO_SERVICE.equals(name)){ | |
return getApplicationContext().getSystemService(name); | |
} | |
return super.getSystemService(name); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment