# Create a View Controller
source: https://developer.mastercard.com/mastercard-checkout-solutions/tutorial/mobile/step2/index.md

## Step 2. Create a View Controller {#step-2-create-a-view-controller}

Now we have enough information to initiate a checkout experience. The merchant application can create an Android activity / iOS view controller which handles creating web-views, launching SRCI flows, and handling results from the SRC back-end.

The following code samples illustrate the setting up of a view controller / activity which can be used to display the SRCI and DCF web pages inside a web view.

The web view for your SRCI experience,
**srciWebView**, is created and initialized to point to the URL of your SRCI
web experience, and then associated with the native view in the view controller / activity.
Later another web-view for the DCF screen will be needed, the way to handle this is described in the following section.
* Java
* Objective-C

```java
// Sample CheckoutActivity

public class CheckoutActivity extends AppCompatActivity {


 @Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  WebView.setWebContentsDebuggingEnabled(true);

  WebView srciWebView = new WebView(this);
  srciWebView.getSettings().setJavaScriptEnabled(true);
  srciWebView.getSettings().setDomStorageEnabled(true);
  srciWebView.getSettings().setSupportMultipleWindows(true);
  srciWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
  srciWebView.setWebViewClient(new CustomWebViewClient(activity));
  srciWebView.setWebChromeClient(new CustomWebChromeClient(activity));

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
   CookieManager.getInstance().setAcceptThirdPartyCookies(srciWebView, true);
  }

  setContentView(srciWebView);

  // URL should be loaded after all setup of web clients is done.
  srciWebView.loadUrl(url); // provide the url of your SRCI experience
 }
}
```

```objective-c
// Sample CheckoutController

- (void)viewDidLoad {
    [super viewDidLoad];

    WKPreferences *preferences = [[WKPreferences alloc] init];
    preferences.javaScriptCanOpenWindowsAutomatically = true;

    WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
    configuration.preferences = preferences;
    [configuration setURLSchemeHandler:self forURLScheme:self.scheme];

    _srciWebView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];
    _srciWebView.UIDelegate = self;
    _srciWebView.navigationDelegate = self;

    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:_url]; // provide the url of your SRCI experience

    [_srciWebView loadRequest:request];
    [_srciWebView setAllowsBackForwardNavigationGestures:YES];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:_srciWebView];
    [self setConstraintsForView:_srciWebView];
    [self.view addSubview:_indicatorView];
}
```

