@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); webView = (WebView) findViewById(R.id.webView); textView = (TextView) findViewById(R.id.textView); try { ProgressAsyncTask asyncTask = new ProgressAsyncTask(webView, textView); asyncTask.execute(10000); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } try { handleData handledata = new handleData(); // System.out.println(weatherTotalInfo2.get(0).getTotalInfo()); handledata.execute(10000); } catch (Exception e) { e.printStackTrace(); } }
public void execute(FragmentActivity activity, String title, String message) { // Create progress fragment progressFragment = new ProgressFragment(); Bundle args = new Bundle(); args.putString("title", title); args.putString("message", message); progressFragment.setArguments(args); activity .getSupportFragmentManager() .beginTransaction() .add(progressFragment, ProgressFragment.DEFAULT_TAG) .commit(); // Start async task ProgressAsyncTask asyncTask = new ProgressAsyncTask(); asyncTask.execute(); }