forked from cory/tildefriends
Prevent the watcher's finalizer from being called before we're done with it.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4408 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
20557e8ce4
commit
fef88e2032
@ -1,5 +1,7 @@
|
||||
package com.unprompted.tildefriends;
|
||||
|
||||
import android.os.StrictMode;
|
||||
import android.os.strictmode.Violation;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
@ -39,6 +41,7 @@ public class MainActivity extends Activity {
|
||||
WebView web_view;
|
||||
String base_url;
|
||||
Process process;
|
||||
WatchService watcher;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -89,7 +92,7 @@ public class MainActivity extends Activity {
|
||||
public void run() {
|
||||
try {
|
||||
Log.w("tildefriends", "Watching for changes in: " + getFilesDir().toString());
|
||||
WatchService watcher = FileSystems.getDefault().newWatchService();
|
||||
watcher = FileSystems.getDefault().newWatchService();
|
||||
Paths.get(getFilesDir().toString()).register(
|
||||
watcher,
|
||||
StandardWatchEventKinds.ENTRY_CREATE,
|
||||
@ -104,6 +107,7 @@ public class MainActivity extends Activity {
|
||||
web_view.loadUrl(base_url);
|
||||
});
|
||||
watcher.close();
|
||||
watcher = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user