32 lines
943 B
Java
32 lines
943 B
Java
import helloworld.R;
|
|
import android.app.Activity;
|
|
import android.os.Bundle;
|
|
import android.widget.TextView;
|
|
import java.io.OutputStream;
|
|
import java.net.URL;
|
|
import javax.net.ssl.HttpsURLConnection;
|
|
|
|
public class HelloWorld extends Activity {
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
try {
|
|
URL url = new URL("https://slcl.privatedns.org");
|
|
HttpsURLConnection c = (HttpsURLConnection) url.openConnection();
|
|
|
|
c.setFollowRedirects(true);
|
|
|
|
OutputStream os = c.getOutputStream();
|
|
System.out.println("Response code:" + c.getResponseCode());
|
|
} catch (Exception e) {
|
|
System.out.println("Exception: " + e.getMessage());
|
|
}
|
|
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_main);
|
|
|
|
TextView text = (TextView)findViewById(R.id.my_text);
|
|
text.setText("Hello, world!");
|
|
}
|
|
}
|