Revision 038ac9a4 src/com/rackspacecloud/android/PingServerActivity.java
b/src/com/rackspacecloud/android/PingServerActivity.java | ||
---|---|---|
4 | 4 |
import android.os.Bundle; |
5 | 5 |
import android.webkit.WebView; |
6 | 6 |
|
7 |
public class PingServerActivity extends Activity{ |
|
8 |
|
|
7 |
public class PingServerActivity extends Activity {
|
|
8 |
|
|
9 | 9 |
private WebView pingSiteView; |
10 | 10 |
private String ipAddress; |
11 | 11 |
private final String url = "http://just-ping.com/index.php?vh=&c=&s=ping!"; |
12 |
|
|
13 |
public void onCreate(Bundle savedInstanceState){ |
|
12 |
|
|
13 |
public void onCreate(Bundle savedInstanceState) {
|
|
14 | 14 |
super.onCreate(savedInstanceState); |
15 | 15 |
setContentView(R.layout.viewpingserver); |
16 | 16 |
ipAddress = (String) this.getIntent().getExtras().get("ipAddress"); |
17 | 17 |
String urlWIp = getUrl(ipAddress); |
18 | 18 |
pingSiteView = (WebView) findViewById(R.id.ping_server_webview); |
19 |
//just-ping.com uses javascript to make requests |
|
19 |
// just-ping.com uses javascript to make requests
|
|
20 | 20 |
pingSiteView.getSettings().setJavaScriptEnabled(true); |
21 | 21 |
pingSiteView.loadUrl(urlWIp); |
22 |
|
|
22 |
|
|
23 | 23 |
} |
24 |
|
|
25 |
private String getUrl(String ip){ |
|
26 |
//put the ip address into the appropriate location in the url |
|
27 |
return url.substring(0, url.indexOf("=")+1) + ip + url.substring(url.indexOf("&")); |
|
28 |
|
|
24 |
|
|
25 |
private String getUrl(String ip) { |
|
26 |
// put the ip address into the appropriate location in the url |
|
27 |
return url.substring(0, url.indexOf("=") + 1) + ip |
|
28 |
+ url.substring(url.indexOf("&")); |
|
29 |
|
|
29 | 30 |
} |
30 | 31 |
|
31 | 32 |
} |
Also available in: Unified diff