title: Make a loader in Xamarin App (C#)
body: <p>I have Android app.</p>
  
  <p>I realized cache for JSON in .txt file. </p>
  
  <p>But when I goes to category, where is text in JSON shows. Screen is freezing for 2-3 seconds and become black. Than Activity opens and I see all of text of my JSON. I think it's freezing because I download images from url that in JSON.</p>
  
  <p>Can I make something like loader? I will tap a button, see loader and json will be read from file , then I see activity.</p>
  
  <p>I download and cache JSON like this</p>
  
  <pre><code> string url2 = "http://papajohn.pp.ua/?mkapi=getProductsByCat&amp;cat_id=83";
          var json2 = await FetchAsync2(url2);
          var path2 = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
          var filename2 = System.IO.Path.Combine(path2, "cache2.txt");
          File.WriteAllText(filename2, json2);
   public async Task&lt;string&gt; FetchAsync(string url)
      {
          string jsonString;
  
          using (var httpClient = new System.Net.Http.HttpClient())
          {
              var stream = await httpClient.GetStreamAsync(url);
              StreamReader reader = new StreamReader(stream);
              jsonString = reader.ReadToEnd();
          }
  
          return jsonString;
      }
  </code></pre>
  
  <p>Show JSON on target activity like this</p>
  
  <pre><code>   var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
          var filename = System.IO.Path.Combine(path, "cache4.txt");
          JsonValue readJson;
          var jsonString = File.ReadAllText(filename);
          readJson = JsonObject.Parse(jsonString);
          Console.WriteLine(jsonString);
  
  
  
  
       private void ParseAndDisplay1(JsonValue readJson)          
       {
              JsonValue firstitem = readJson[0];
  
              productname.Text = firstitem["post_title"];
              price.Text = firstitem["price"] + "грн";
              weight.Text = firstitem["weight"] + "г";
              var imageBitmap = GetImageBitmapFromUrl1(firstitem["img_url"]);
              imagen.SetImageBitmap(imageBitmap);
        }
  </code></pre>
  
  <p>Thank's for help.</p>