Android Open Source - FCV Api Controller






From Project

Back to project page FCV.

License

The source code is released under:

Apache License

If you think the Android project FCV 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 fcv.tomazini.automacaoresidencial.util;
/*from w  w w  .  j a  v a 2  s  . c o  m*/
import android.app.ProgressDialog;
import android.os.AsyncTask;

public class ApiController {

  private ProgressDialog progressDialog;
  private GetApi api;

  public ApiController(ProgressDialog progressDialog) {
    this.progressDialog = progressDialog;
  }

  public void sincronizar(String action, String location) {
    api = new GetApi(location);
    new SincronizarDados().execute(action);
  }

  private class SincronizarDados extends AsyncTask<String, Void, Void> {

    @Override
    protected void onPreExecute() {
      super.onPreExecute();
      progressDialog.setCancelable(false);
      progressDialog.setMessage("efetuando comunica??o...");
      progressDialog.show();
    }

    @Override
    protected Void doInBackground(String... params) {
      SincronizarConsumo(params[0]);
      return null;
    }

    @Override
    protected void onPostExecute(Void result) {
      super.onPostExecute(result);
      progressDialog.dismiss();
    }

    private Void SincronizarConsumo(String action) {
      api.getFromApi(action);
      return null;
    }
  }
}




Java Source Code List

fcv.tomazini.automacaoresidencial.MainActivity.java
fcv.tomazini.automacaoresidencial.util.ApiController.java
fcv.tomazini.automacaoresidencial.util.GetApi.java