Issue
I have written webview on which there may be youtube videos. When I start video and press home button application closes (Goes in background) and I can still hear audio. Then I had to kill task manually (Using battary-doctor now !!)
I have tried onPause() and onStop() methods and tried to call finish() but it is not working. I saw some questions where it is written it is not possible to override home button.
What I want to do is kill the activity once home button is pressed. If android is handling killing ... fine .. but just pause the youtube video and then go to background !!!
Can someone help ??
Solution
Rather than killing the activity, you should just clear the WebView. onPause() is called when the activity goes into background, so that's where you should attempt to "unload" the WebView.
@Override
protected void onPause() {
super.onPause();
mWebView.loadUrl("about:blank");
}
Answered By - aluxian
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.