Android Open Source - sami-android-demo Task






From Project

Back to project page sami-android-demo.

License

The source code is released under:

Apache License

If you think the Android project sami-android-demo 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 io.samsungsami.android.api;
//from ww  w .j  a  va2  s.co  m
import android.os.AsyncTask;
import android.util.Log;

public class Task extends AsyncTask<Void, Void, Object> {
  public static final String TAG = Task.class.getName();
  Code code;
  Callback callback;
  
  public Task(final Code code){
    this.code = code;
    this.callback = null;
  }
  
  public Task(final Code code, Callback callback){
    this.code = code;
    this.callback = callback;
  }
    
  @Override
  protected void onCancelled() {
    Log.d(TAG, "Async task cancelled.");
    super.onCancelled();
  }

  @Override
  protected Object doInBackground(Void... params) {
    Object ret = null;
    if(code != null){
      ret = code.run();
    } 
    return ret;
  }  
   
    /**
     * Sends callback to the context activity
     * @param result
     */
    protected void onPostExecute(Object result) {
      if(callback != null){
        callback.onApiResult(result);
      }
    }
}




Java Source Code List

io.samsungsami.android.AccountsActivity.java
io.samsungsami.android.AccountsWebClient.java
io.samsungsami.android.AccountsWebView.java
io.samsungsami.android.Credentials.java
io.samsungsami.android.SamiClient.java
io.samsungsami.android.SamiHub.java
io.samsungsami.android.SamiStack.java
io.samsungsami.android.Sami.java
io.samsungsami.android.api.Call.java
io.samsungsami.android.api.Callback.java
io.samsungsami.android.api.Cast.java
io.samsungsami.android.api.Code.java
io.samsungsami.android.api.Task.java
io.samsungsami.androidclient.Config.java
io.samsungsami.androidclient.DevicesActivity.java
io.samsungsami.androidclient.ExpandableAdapter.java
io.samsungsami.androidclient.GenericAdapter.java
io.samsungsami.androidclient.Item.java
io.samsungsami.androidclient.MessagesActivity.java
io.samsungsami.androidclient.RegisterActivity.java
io.samsungsami.androidclient.SamiActivity.java
sami.utils.FileUtils.java