title: How to move main thread forward after the background thread finishes it's work
body: <p>I am making a network call and fetching the topology as soon as user launch the app. 
  Here is the catch, to fetch the topology first I need few of the values from other app's content provider, Every other answer, blogs on the internet says that the querying to ContentProvider should happen in the background thread; which make sense for me as well. But if i make background thread and make query to CP, my app's main thread will start executing before I get the values from CP. How to tackle this scenario?</p>
  
  <p>So far I tried AsyncTask and showed Progress Dialog in preExecute() and dismiss it on postExecute() but then also it has no use for my scenario.</p>
  
  <pre><code> @Override
      protected void onPreExecute() {
          super.onPreExecute();
          // building URI for content resolver
          //contentURI = new Uri.Builder().build().parse(contentPath);
          progressDialog.setMessage("calling ContentProvider");
          progressDialog.setIndeterminate(true);
          progressDialog.setCancelable(false);
          progressDialog.setCanceledOnTouchOutside(false);
  
          if(!SplashActivity.this.isFinishing()) {
              progressDialog.show();
          }
          Log.d(TAG, "calling ContentProvider ");
          Log.d(TAG, "calling @ ===&gt; " + contentURI);
      }
  
      @Override
      protected Cursor doInBackground(Void... voids) {
          ContentResolver resolver = getContentResolver();
          try{
              Cursor cursor = resolver.query(contentURI, null, null, null, null);
              return cursor;
          }catch (Exception e){
              e.getLocalizedMessage();
          }
          return null;
      }
  
      @Override
      protected void onPostExecute(Cursor cursor) {
          super.onPostExecute(cursor);
  
          if (null == cursor) {
              Log.e(TAG, "ContentProvider returned null response.");
          } else if (cursor.getCount() &lt; 1) {
              Log.e(TAG, "ContentProvider returned empty response.");
          } else {
              Log.d(TAG, "ContentProvider returned Data Successfully.");
              mContentProviderData = cursor;
              int rawReturned = cursor.getCount();
              Log.d(TAG, "Number of raws returned into CP: " + String.valueOf(rawReturned));
          }
  
          progressDialog.dismiss();
      }
  </code></pre>