[Android] AudioService: use a weak handler instead of a static one
Ludovic Fauvet
git at videolan.org
Wed May 22 16:55:04 CEST 2013
vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed May 22 16:47:30 2013 +0200| [d45a0acf0a489e82c851536b8a5668a1a2920898] | committer: Ludovic Fauvet
AudioService: use a weak handler instead of a static one
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d45a0acf0a489e82c851536b8a5668a1a2920898
---
vlc-android/src/org/videolan/vlc/AudioService.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 33b08af..f917490 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -433,7 +433,7 @@ public class AudioService extends Service {
service.updateWidgetPosition(service, pos);
break;
case EventHandler.MediaPlayerEncounteredError:
- showToast(VLCApplication.getAppContext().getString(R.string.invalid_location,
+ service.showToast(VLCApplication.getAppContext().getString(R.string.invalid_location,
service.mCurrentMedia.getLocation()), Toast.LENGTH_SHORT);
service.executeUpdate();
service.next();
@@ -1139,7 +1139,7 @@ public class AudioService extends Service {
return true;
}
- private static void showToast(String text, int duration) {
+ private void showToast(String text, int duration) {
Message msg = new Message();
Bundle bundle = new Bundle();
bundle.putString("text", text);
@@ -1148,7 +1148,7 @@ public class AudioService extends Service {
toastHandler.sendMessage(msg);
}
- private static Handler toastHandler = new Handler() {
+ private WeakHandler<AudioService> toastHandler = new WeakHandler<AudioService>(this) {
@Override
public void handleMessage(Message msg) {
final Bundle bundle = msg.getData();
More information about the Android
mailing list