Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to show e message alert when data load and auto close when data is loaded – xamarin

I want to show message alert when data is loading and auto close this message when data is loaded, because I have a too much data for displaying with this code:

private async Task GetAPI()
    {
        var client = new HttpClient();
        var request = new HttpRequestMessage
        {
            Method = HttpMethod.Get,
            RequestUri = new Uri("https://crypto-news-live.p.rapidapi.com/news/coindesk"),
            Headers =
        {
            { "x-rapidapi-host", "crypto-news-live.p.rapidapi.com" },
            { "x-rapidapi-key", "51569aba99mshf9e839fcfce791bp16c0dbjsn9ced6dba7472" },
        },
        };
        using (var response = await client.SendAsync(request))
        {
            var news = new News();
            response.EnsureSuccessStatusCode();
            var body = await response.Content.ReadAsStringAsync();
            var newsBody = JsonConvert.DeserializeObject<List<NewsBody>>(body);
            news.CryptoNews = newsBody;
            lstNews.ItemsSource = newsBody;
        }
    }

Until the ListView is filled with data through the simulator wait between 5 and 7 seconds.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Yes, you can do it using Toast message plugin available for Xamarin.Forms.

When you are calling data load service just before that show a loader with message and when data loading is complete remove that loader that’s it.

Check this blog for reference:

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading