aboutsummaryrefslogtreecommitdiff
path: root/HelloWorld.java
blob: 4f93a658f0631178aa638925a113c57f902dd5a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 {
            Test t = new Test();
            URL url = new URL("https://slcl.privatedns.org");
            HttpsURLConnection c = (HttpsURLConnection) url.openConnection();

            t.f();

            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!");
    }
}