title: Load values from WEB before MainActivity start
body: <p>My app have Search filed with autocomplete.</p>
  
  <p>Now I have these:</p>
  
  <p>1) AsyncTask class that loads Dictionary and save it in file to InternalStorage (I need it to use preloaded items in case when network unavailable).</p>
  
  <p>2) Application class with overrided onCreate Method. Here I executing AsyncTask (1).</p>
  
  <p>The problem is that MainActivity with Search filed starts before AsyncTask finished, so autocomplete loaded NOT relevant (old) dictionary.</p>
  
  <p>I need to complete my AsyncTask <strong>no earlier than</strong> MainActivity loads dictionary file from Internal Storage.</p>
  
  <p>How can I achieve this?
  Thanks for Answers. </p>
  
  <p>upd: Okay, there is code:</p>
  
  <pre><code>package com.XXX.XXX.app;
  
  import android.app.Application;
  
  public class MyApp extends Application {
      @Override
      public void onCreate()
      {
          super.onCreate();
          if (CheckNetworkConnect.check(MyApp.this)) {
              LoadData getData = new LoadData(MyApp.this);
              getData.execute();
          }
      }
  }
  </code></pre>
  
  <p>After that I load file <strong>in MainActivity</strong> class from Internal Storage with my own InternalStorage class.</p>
  
  <pre><code>try {
          acList = (ArrayList&lt;String&gt;) InternalStorage.readObject(MainActivity.this, "aclist");
      } catch (ClassNotFoundException e) {
          e.printStackTrace();
      } catch (IOException e) {
          acList = new ArrayList&lt;String&gt;(Arrays.asList("NO FILE"));
          e.printStackTrace();
      }
  </code></pre>
  
  <p>And then applying getted ArrayList to dropdown</p>
  
  <pre><code> ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
              R.layout.dropdown_item, acList);
      AutoCompleteTextView textView = (AutoCompleteTextView)
              findViewById(R.id.searchFiled);
      searchFiled.setAdapter(adapter);
  </code></pre>