Code example for AsyncTask

Methods: execute

0
                                          T... params) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
    } 
    else { 
      task.execute(params);
    } 
  } 
 
  private class ContentsLoadTask extends AsyncTask<Context, Void, Void> {
    private BookContents localContents=null;
    private Exception e=null;
 
    @Override 
    protected Void doInBackground(Context... ctxt) {
      try { 
        StringBuilder buf=new StringBuilder();
        InputStream json=ctxt[0].getAssets().open("book/contents.json");
        BufferedReader in=
            new BufferedReader(new InputStreamReader(json));
        String str;