Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Webservice data is not displaying in emulator

$
0
0

Hi guys, i am trying bind data from webservice http://api.androidhive.info/contacts/ but when run the application it will keeps on loading in emulator
i am not aware what is the problem i have shared snapshot

and code please help me

public async void GetJSON()
    {
        //Check network status
        if (NetworkCheck.IsInternet())
        {

            var client = new System.Net.Http.HttpClient();
            var response = await client.GetAsync("http://api.androidhive.info/contacts/");
            string contactsJson = await response.Content.ReadAsStringAsync();
            ContactList ObjContactList = new ContactList();
            if (contactsJson != "")
            {
                //Converting JSON Array Objects into generic list
                ObjContactList = JsonConvert.DeserializeObject<ContactList>(contactsJson);
            }
            //Binding listview with server response
            listviewConacts.ItemsSource = ObjContactList.contacts;
        }
        else
        {
            await DisplayAlert("JSONParsing", "No network is available.", "Ok");
        }
        //Hide loader after server response
        ProgressLoader.IsVisible = false;
    }

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>