From 6837a4482f1b922962028010ce690146b4aef349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Mon, 13 Feb 2012 20:03:12 +0100 Subject: Make Android app behave. Doing things slightly more correctly. --- same-android/src/main/java/com/orbekk/SameControllerActivity.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'same-android/src/main/java/com/orbekk/SameControllerActivity.java') diff --git a/same-android/src/main/java/com/orbekk/SameControllerActivity.java b/same-android/src/main/java/com/orbekk/SameControllerActivity.java index c8c1ebd..a2d5688 100644 --- a/same-android/src/main/java/com/orbekk/SameControllerActivity.java +++ b/same-android/src/main/java/com/orbekk/SameControllerActivity.java @@ -115,14 +115,14 @@ public class SameControllerActivity extends Activity { setContentView(R.layout.controller); showIpAddress(); - - Intent intent = new Intent(this, SameService.class); - bindService(intent, sameConnection, Context.BIND_AUTO_CREATE); } @Override public void onStart() { super.onResume(); + Intent intent = new Intent(this, SameService.class); + bindService(intent, sameConnection, Context.BIND_AUTO_CREATE); + IntentFilter sameServiceUpdates = new IntentFilter( SameService.AVAILABLE_NETWORKS_UPDATE); registerReceiver(broadcastReceiver, sameServiceUpdates); @@ -133,6 +133,7 @@ public class SameControllerActivity extends Activity { if (sameService != null) { unbindService(sameConnection); } + unregisterReceiver(broadcastReceiver); } @Override -- cgit v1.2.3