summaryrefslogtreecommitdiff
path: root/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-31 14:19:39 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-31 14:19:39 +0100
commiteacd71d700c402e79edec9427b2fe1fb5e6b278e (patch)
treeb02eaea91df8d76634c0319409ab147e67b7f7a6 /same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
parentc53846bfad9c75ab24ae9051470b4d102e083538 (diff)
Support custom search address.
Diffstat (limited to 'same-android/src/main/java/com/orbekk/HelloAndroidActivity.java')
-rw-r--r--same-android/src/main/java/com/orbekk/HelloAndroidActivity.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java b/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
index 81eebc4..c8c27f3 100644
--- a/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
+++ b/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
@@ -1,5 +1,7 @@
package com.orbekk;
+import java.net.InetAddress;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -14,6 +16,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
+import android.widget.EditText;
import android.widget.TextView;
public class HelloAndroidActivity extends Activity {
@@ -30,6 +33,9 @@ public class HelloAndroidActivity extends Activity {
logger.info("Joining network");
Intent intent = new Intent(this, SameService.class);
intent.setAction("join");
+ // InetAddress address = new Broadcaster(this).getBroadcastAddress();
+ EditText t = (EditText)findViewById(R.id.editText1);
+ intent.putExtra("ip", t.getText().toString());
startService(intent);
}
@@ -39,6 +45,11 @@ public class HelloAndroidActivity extends Activity {
t.append(new Broadcaster(this).getWlanAddress().getHostAddress());
}
+ private void showBroadcastAddress() {
+ EditText t = (EditText)findViewById(R.id.editText1);
+ t.setText(new Broadcaster(this).getBroadcastAddress().getHostAddress());
+ }
+
/**
* Called when the activity is first created.
* @param savedInstanceState If the activity is being re-initialized after
@@ -54,6 +65,7 @@ public class HelloAndroidActivity extends Activity {
setContentView(R.layout.main);
showIpAddress();
+ showBroadcastAddress();
// ClientApp client = new ClientApp();
// SameInterface client_ = client.getClient(10015, "ClientNetwork",