coodoing / dataasync

easy use of android asynctask

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dataasync

dataasync is an async package for a easy use of Android AsyncTask .

easy to use

1 define the async task and execute it

private AsyncTask<Void, Void, JSONResponse> testTask;

Map<String, String> params = new HashMap<String, String>();
if (null != params) {
	params.put("KEY", "VALUE");
	testTask = new CommonTask(params, Constants.URL, testTaskCallback);
	testTask.execute();
}

2 callback after the task

private DataAsyncTask.TaskCallBack<JSONResponse> testTaskCallback = new DataAsyncTask.TaskCallBack<JSONResponse>() {
	@Override
	public void onTaskFinish(JSONResponse response) {
		if (response.isSucceed()) {
			// TODO
		} else {
		}
	}
};

About

easy use of android asynctask

License:Apache License 2.0


Languages

Language:Java 100.0%