summaryrefslogtreecommitdiff
path: root/same-android/src/main/java/com/orbekk
diff options
context:
space:
mode:
Diffstat (limited to 'same-android/src/main/java/com/orbekk')
-rw-r--r--same-android/src/main/java/com/orbekk/SameControllerActivity.java15
-rw-r--r--same-android/src/main/java/com/orbekk/SameService.java10
2 files changed, 9 insertions, 16 deletions
diff --git a/same-android/src/main/java/com/orbekk/SameControllerActivity.java b/same-android/src/main/java/com/orbekk/SameControllerActivity.java
index a2d5688..4fb1424 100644
--- a/same-android/src/main/java/com/orbekk/SameControllerActivity.java
+++ b/same-android/src/main/java/com/orbekk/SameControllerActivity.java
@@ -49,8 +49,10 @@ public class SameControllerActivity extends Activity {
if (SameService.AVAILABLE_NETWORKS_UPDATE.equals(intent.getAction())) {
ArrayList<String> networkList = intent.getStringArrayListExtra(
SameService.AVAILABLE_NETWORKS);
- Toast.makeText(SameControllerActivity.this, networkList.toString(),
- Toast.LENGTH_SHORT).show();
+ ListView list = (ListView)findViewById(R.id.network_list);
+ list.setAdapter(new ArrayAdapter<String>(
+ SameControllerActivity.this,
+ R.layout.list_text_item, networkList));
}
}
};
@@ -89,15 +91,6 @@ public class SameControllerActivity extends Activity {
public void searchNetworks(View unused) {
logger.info("SearchNetworks()");
-// Toast.makeText(this, "Discovering networks", Toast.LENGTH_SHORT).show();
-// final String[] listItems = new String[]{"First item", "Second item"};
-// ListView list = (ListView)findViewById(R.id.network_list);
-// list.setAdapter(new ArrayAdapter<String>(this, R.layout.list_text_item,
-// listItems));
-
-// Message message = Message.obtain(null, SameService.DISPLAY_MESSAGE,
-// "Message from Activity!");
-
Message searchMessage = Message.obtain(null, SameService.SEARCH_NETWORKS);
try {
sameService.send(searchMessage);
diff --git a/same-android/src/main/java/com/orbekk/SameService.java b/same-android/src/main/java/com/orbekk/SameService.java
index 305bf44..bc758ab 100644
--- a/same-android/src/main/java/com/orbekk/SameService.java
+++ b/same-android/src/main/java/com/orbekk/SameService.java
@@ -41,19 +41,19 @@ public class SameService extends Service {
private SameController sameController = null;
private Configuration configuration = null;
- // A list with alternating network names and urls.
- private ArrayList<String> availableNetworks = new ArrayList<String>();
+ private ArrayList<String> networkNames = new ArrayList<String>();
+ private ArrayList<String> networkUrls = new ArrayList<String>();
private NetworkNotificationListener networkListener =
new NetworkNotificationListener() {
@Override
public void notifyNetwork(String networkName, String masterUrl) {
logger.info("notifyNetwork({})", networkName);
- availableNetworks.add(networkName);
- availableNetworks.add(masterUrl);
+ networkNames.add(networkName);
+ networkUrls.add(masterUrl);
Intent intent = new Intent(AVAILABLE_NETWORKS_UPDATE);
intent.putStringArrayListExtra(AVAILABLE_NETWORKS,
- availableNetworks);
+ networkNames);
sendBroadcast(intent);
}
};