aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-07-30 10:12:18 +0200
committerMax Kellermann <max@duempel.org>2014-07-30 10:17:31 +0200
commit6ba0b029e666212bea619a73153c146ab9f19c15 (patch)
tree9aa4ac1601afb1e11ed46618cbf6b234242c1daf
parent604c9dacdbd3c0ed3b86dfd5a125ce6f0ce8b509 (diff)
downloadmpd-6ba0b029e666212bea619a73153c146ab9f19c15.tar.gz
mpd-6ba0b029e666212bea619a73153c146ab9f19c15.tar.xz
mpd-6ba0b029e666212bea619a73153c146ab9f19c15.zip
android/Main: indicate when the native code has quit
Let the user know that MPD has failed. Not the best thing to do, but better than pretending it still runs.
-rw-r--r--android/src/Main.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/android/src/Main.java b/android/src/Main.java
index 3910c850d..d87f7709b 100644
--- a/android/src/Main.java
+++ b/android/src/Main.java
@@ -21,8 +21,10 @@ package org.musicpd;
import android.app.Activity;
import android.os.Bundle;
-import android.widget.TextView;
import android.os.Build;
+import android.os.Handler;
+import android.os.Message;
+import android.widget.TextView;
import android.util.Log;
public class Main extends Activity implements Runnable {
@@ -30,6 +32,16 @@ public class Main extends Activity implements Runnable {
Thread thread;
+ TextView textView;
+
+ final Handler quitHandler = new Handler() {
+ public void handleMessage(Message msg) {
+ textView.setText("Music Player Daemon has quit");
+
+ // TODO: what now? restart?
+ }
+ };
+
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -50,13 +62,14 @@ public class Main extends Activity implements Runnable {
thread.start();
}
- TextView tv = new TextView(this);
- tv.setText("Music Player Daemon is running"
- + "\nCAUTION: this version is EXPERIMENTAL!");
- setContentView(tv);
+ textView = new TextView(this);
+ textView.setText("Music Player Daemon is running"
+ + "\nCAUTION: this version is EXPERIMENTAL!");
+ setContentView(textView);
}
@Override public void run() {
Bridge.run(this);
+ quitHandler.sendMessage(quitHandler.obtainMessage());
}
}