mirror of
http://galexander.org/git/simplesshd.git
synced 2025-07-08 11:58:05 +00:00
if there are multiple interfaces up, go ahead and list them all
This commit is contained in:
parent
698ce0c52c
commit
fc20a31b6c
@ -8,9 +8,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:typeface="monospace"
|
android:typeface="monospace"
|
||||||
android:singleLine="true"
|
|
||||||
android:background="#ff112266"
|
android:background="#ff112266"
|
||||||
android:scrollHorizontally="true"
|
|
||||||
android:text="IP: XXX" />
|
android:text="IP: XXX" />
|
||||||
<EditText android:id="@+id/log"
|
<EditText android:id="@+id/log"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -47,7 +47,7 @@ public class SimpleSSHD extends Activity
|
|||||||
update_startstop_prime();
|
update_startstop_prime();
|
||||||
updater = new UpdaterThread();
|
updater = new UpdaterThread();
|
||||||
updater.start();
|
updater.start();
|
||||||
ip_view.setText("IP: "+get_ip());
|
ip_view.setText(get_ip());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
@ -166,6 +166,7 @@ public class SimpleSSHD extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String get_ip() {
|
public static String get_ip() {
|
||||||
|
String ret = "";
|
||||||
try {
|
try {
|
||||||
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
||||||
for (NetworkInterface intf : interfaces) {
|
for (NetworkInterface intf : interfaces) {
|
||||||
@ -178,11 +179,14 @@ public class SimpleSSHD extends Activity
|
|||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
ip = ip.substring(0,i);
|
ip = ip.substring(0,i);
|
||||||
}
|
}
|
||||||
return ip;
|
if (!ret.equals("")) {
|
||||||
|
ret += "\n";
|
||||||
|
}
|
||||||
|
ret += "IP: "+ ip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) { } // for now eat exceptions
|
} catch (Exception ex) { } // for now eat exceptions
|
||||||
return "";
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user