Moved main Activity to ui sub-package
[strongswan.git] / src / frontends / android / src / org / strongswan / android / ui / MainActivity.java
1 package org.strongswan.android.ui;
2
3 import android.app.Activity;
4 import android.content.Intent;
5 import android.net.VpnService;
6 import android.os.Bundle;
7
8 public class MainActivity extends Activity
9 {
10 @Override
11 public void onCreate(Bundle savedInstanceState)
12 {
13 super.onCreate(savedInstanceState);
14 setContentView(R.layout.main);
15 startVpnService();
16 }
17
18 private void startVpnService()
19 {
20 Intent intent = VpnService.prepare(this);
21 if (intent != null)
22 {
23 startActivityForResult(intent, 0);
24 }
25 else
26 {
27 onActivityResult(0, RESULT_OK, null);
28 }
29 }
30
31 @Override
32 protected void onActivityResult(int requestCode, int resultCode, Intent data)
33 {
34 if (resultCode == RESULT_OK)
35 {
36 Intent intent = new Intent(this, CharonVpnService.class);
37 startService(intent);
38 }
39 }
40 }