Android开发(三十二)——延时

模拟延时

private class GetDataTask extends AsyncTask<Void, Void, String[]> {

    @Override
    protected String[] doInBackground(Void... params) {
        // Simulates a background job.
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
        return null;
    }

    @Override
    protected void onPostExecute(String[] result) {
        // Do some stuff here

        // Call onRefreshComplete when the list has been refreshed.
        mPullRefreshScrollView.onRefreshComplete();

        super.onPostExecute(result);
    }
}


//调用
new GetDataTask().execute();

 

posted @ 2015-07-12 15:42  长城的草  阅读(386)  评论(0编辑  收藏  举报