From 00049d4b2f2dc59d1dde8901037069ee22544fc9 Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sat, 26 Dec 2015 15:21:41 -0500 Subject: [PATCH] Allow launch of ListenActivity from found ProtectBabyMonitor service If any ProtectBabyMonitor services are found on the network, clicking on one will start a ListenActivity with information on the service. --- src/protect/babymonitor/DiscoverActivity.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/protect/babymonitor/DiscoverActivity.java b/src/protect/babymonitor/DiscoverActivity.java index 4cd050d..c745330 100644 --- a/src/protect/babymonitor/DiscoverActivity.java +++ b/src/protect/babymonitor/DiscoverActivity.java @@ -18,6 +18,7 @@ package protect.babymonitor; import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.net.nsd.NsdManager; import android.net.nsd.NsdServiceInfo; import android.os.Bundle; @@ -118,6 +119,21 @@ public class DiscoverActivity extends Activity serviceText.setText(serviceInfo.getServiceName()); row.addView(serviceText); serviceText.setTextSize(20); + + serviceText.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + Intent i = new Intent(getApplicationContext(), ListenActivity.class); + Bundle b = new Bundle(); + b.putString("address", serviceInfo.getHost().getHostAddress()); + b.putInt("port", serviceInfo.getPort()); + b.putString("name", serviceInfo.getServiceName()); + i.putExtras(b); + startActivity(i); + } + }); } }); }