Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Android.App;
- using Android.Content;
- using Android.Runtime;
- using Android.Views;
- using Android.Widget;
- using Android.OS;
- using System.Threading.Tasks;
- using System.Collections.Generic;
- using Simple.OData.Client;
- using System.Net;
- using System.Net.Http;
- namespace ODataTest
- {
- [Activity (Label = "ODataTest", MainLauncher = true, Icon = "@drawable/icon")]
- public class MainActivity : Activity
- {
- HttpClient hc = new HttpClient ();
- protected override void OnCreate (Bundle bundle)
- {
- base.OnCreate (bundle);
- // Set our view from the "main" layout resource
- SetContentView (Resource.Layout.Main);
- Task<HttpResponseMessage> newTask = GetWebsite ();
- newTask.Wait ();
- var x = newTask.Result;
- //WebRequest wr = WebRequest.Create ("www.google.com");
- //WebResponse wresp = wr.GetResponse ();
- }
- public async Task<HttpResponseMessage> GetWebsite()
- {
- var uri = Android.Net.Uri.Parse ("http://www.xamarin.com");
- return await hc.GetAsync (uri.ToString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement