I'm trying to figure out how can I download content from server before running UI and setting ViewPager adapter. I got JSON file on my server and app reads that properly, but I can't update ViewPager.

Ideally, what I want to do is to make a dialog that says something like "Please wait, we are checking if there are any new contents" with circular loading thing (just to show that it's working) and if yes - to download it and make content fresh and if not to use last content.

It looks like that right now. It works as is - where should I take it from here?

```
public class MainActivity extends Activity {

MediaPlayer mp;
ViewPager viewPager;
PagerAdapter adapter;
//int[] sounds;
int[] g;
String[] title;
int[] description;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.viewpager_main);

    // Generate data

    title = new String[] { "A1", "A2", "A3","A4" };

    description = new int[] { R.string.a1, R.string.a2, R.string.a3, R.string.a4 };

    gun = new int[] {R.drawable.obr4,R.drawable.obr4,R.drawable.obr4,R.drawable.obr4};

    // Locate the ViewPager in viewpager_main.xml
    viewPager = (ViewPager) findViewById(R.id.pager);
    // Pass results to ViewPagerAdapter Class
    adapter = new ViewPagerAdapter(MainActivity.this, g, title,
            description);
    // Binds the Adapter to the ViewPager
    viewPager.setAdapter(adapter);

    if (VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        viewPager.setPageTransformer(true, new DepthPageTransformer());
    }

    new GetUpdate().execute();
}

class GetUpdate extends AsyncTask<Void, Void, Void>{

    JSONObject jobj = null;
    @Override
    protected Void doInBackground(Void... params) {             

        //JSON
        JSONParser jparser = new JSONParser();
        JSONObject data = jparser.getJSONFromUrl("http://myserver.com/file.json");                      

        String title2 = "";

        try {
            jobj = data.getJSONObject("party2");                
            title2 = jobj.getString("title");
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //title = new String[] { title2,title2,title2,title2}; <- commented 'cause doesn't work

        return null;
    }

}

```