Android Open Source - isidore Load Droplets Async






From Project

Back to project page isidore.

License

The source code is released under:

GNU General Public License

If you think the Android project isidore 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.tbardici.isidore;
//from w ww .  java 2 s . c  o m
import org.json.JSONException;
import org.json.JSONObject;

import com.tbardici.isidore.droplet.MyDroplets;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;

/**
 * 
 * @author Teo
 *
 */
public class LoadDropletsAsync extends AsyncTask<Void, String, Void>{

  private Context context;
  private ProgressDialog dialog;
  
  public LoadDropletsAsync(Context ctx){
    this.context = ctx;
    this.dialog = new ProgressDialog(this.context);
  }
  
  @Override
  protected void onPreExecute() {
    this.dialog.setTitle("Please wait.");
    this.dialog.setMessage("Loading droplets...");
    this.dialog.show();
  }  
  
  @Override
  protected void onPostExecute(Void result) {
    this.dialog.dismiss();
    Intent intent1 = new Intent(this.context, ItemListActivity.class);
    this.context.startActivity(intent1);
  }
  
  @Override
  protected Void doInBackground(Void... unused) {
    try {
      String url;
        JSONObject response;
          //get all the sizes and initialize our DropletType collection
          url = DOApi.getUrl(DOApi.API.DROPLETS_GET_ALL,  null);
      response = DOApi.callApi(url);
      MyDroplets.initialize(response);
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    
    return null;
  }
  
  @Override
  protected void onProgressUpdate(String... values) {
    this.dialog.setMessage(values[0]);
  }

}




Java Source Code List

com.tbardici.isidore.CallDOApiAsync.java
com.tbardici.isidore.CreateDropletActivity.java
com.tbardici.isidore.DCConfirmDialogFragment.java
com.tbardici.isidore.DOApi.java
com.tbardici.isidore.DrawablePreviewActivity.java
com.tbardici.isidore.DropletImage.java
com.tbardici.isidore.DropletListAdapter.java
com.tbardici.isidore.DropletType.java
com.tbardici.isidore.IsidoreSettings.java
com.tbardici.isidore.ItemDetailActivity.java
com.tbardici.isidore.ItemDetailFragment.java
com.tbardici.isidore.ItemListActivity.java
com.tbardici.isidore.ItemListFragment.java
com.tbardici.isidore.LoadDropletsAsync.java
com.tbardici.isidore.LongDurationCall.java
com.tbardici.isidore.MainActivity.java
com.tbardici.isidore.Region.java
com.tbardici.isidore.droplet.MyDroplets.java