Android Open Source - SmartHome Common Async Task






From Project

Back to project page SmartHome.

License

The source code is released under:

GNU General Public License

If you think the Android project SmartHome listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.geekytheory.SmartHome_App;
/*from  w w  w .j av a  2  s.  c om*/
/**
 * Author: Mario Prez Esteso
 * Website: http://geekytheory.com
 * Mail: mario@geekytheory.com
 */

import java.io.IOException;

import android.os.AsyncTask;

abstract class CommonAsyncTask extends AsyncTask<Void, Void, Boolean> {

  final MyActivity activity;

  CommonAsyncTask(MyActivity activity) {
    this.activity = activity;
  }

  @Override
  protected void onPreExecute() {
    super.onPreExecute();
  }

  @Override
  protected final Boolean doInBackground(Void... ignored) {
    try {
      doInBackground();
      return true;
    } catch (Exception e) {
      Utils.logAndShow(activity, "MyActivity", e);
    }
    return false;
  }

  @Override
  protected final void onPostExecute(Boolean success) {
    super.onPostExecute(success);
    if (success) {
      activity.refreshView();
    }
  }

  protected void doInBackground() throws IOException {

  }

}




Java Source Code List

com.geekytheory.SmartHome_App.About.java
com.geekytheory.SmartHome_App.AsyncLoadTasks.java
com.geekytheory.SmartHome_App.CommonAsyncTask.java
com.geekytheory.SmartHome_App.CustomHttpClient.java
com.geekytheory.SmartHome_App.DeviceItem.java
com.geekytheory.SmartHome_App.JSONuse.java
com.geekytheory.SmartHome_App.MyActivity.java
com.geekytheory.SmartHome_App.TestFragment.java
com.geekytheory.SmartHome_App.Utils.java