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();

 

你可能感兴趣的:(Android开发)