Android Mobile Physical Therapy Exercise Documenter

com.communipatient.amptedapp.data
Class DownloadImageTask

java.lang.Object
  extended by android.os.AsyncTask<java.lang.String,java.lang.Integer,android.graphics.Bitmap>
      extended by com.communipatient.amptedapp.data.DownloadImageTask

public class DownloadImageTask
extends android.os.AsyncTask<java.lang.String,java.lang.Integer,android.graphics.Bitmap>

The task that loads the image with the specified URL into the provided image view using a background task.


Nested Class Summary
 
Nested classes/interfaces inherited from class android.os.AsyncTask
android.os.AsyncTask.Status
 
Field Summary
private  android.widget.ImageButton button
          The button that will be displayed.
private  android.widget.ImageView image
          The image that will be displayed.
 
Constructor Summary
DownloadImageTask(android.widget.ImageButton button)
          Initializes a new instance of the DownloadImageTask.
DownloadImageTask(android.widget.ImageView image)
          Initializes a new instance of the DownloadImageTask.
 
Method Summary
protected  android.graphics.Bitmap doInBackground(java.lang.String... params)
          The backgrounds the requested image.
private static android.graphics.Bitmap GetCachedFile(android.content.Context c, java.net.URL url)
          Load the image from the file cache if possible.
private static android.graphics.Bitmap GetRemoteFile(java.net.URL url)
          Load the image from the remote URL.
protected  void onPostExecute(android.graphics.Bitmap result)
          Deal with the result.
protected  void onProgressUpdate(java.lang.Integer... progress)
          Update the background tasks.
 
Methods inherited from class android.os.AsyncTask
cancel, execute, get, get, getStatus, isCancelled, onCancelled, onPreExecute, publishProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

image

private android.widget.ImageView image
The image that will be displayed.


button

private android.widget.ImageButton button
The button that will be displayed.

Constructor Detail

DownloadImageTask

public DownloadImageTask(android.widget.ImageView image)
Initializes a new instance of the DownloadImageTask.

Parameters:
image -

DownloadImageTask

public DownloadImageTask(android.widget.ImageButton button)
Initializes a new instance of the DownloadImageTask.

Parameters:
button - The image button to load the image into.
Method Detail

doInBackground

protected android.graphics.Bitmap doInBackground(java.lang.String... params)
The backgrounds the requested image.

Specified by:
doInBackground in class android.os.AsyncTask<java.lang.String,java.lang.Integer,android.graphics.Bitmap>

onProgressUpdate

protected void onProgressUpdate(java.lang.Integer... progress)
Update the background tasks. This is not used yet.

Overrides:
onProgressUpdate in class android.os.AsyncTask<java.lang.String,java.lang.Integer,android.graphics.Bitmap>

onPostExecute

protected void onPostExecute(android.graphics.Bitmap result)
Deal with the result.

Overrides:
onPostExecute in class android.os.AsyncTask<java.lang.String,java.lang.Integer,android.graphics.Bitmap>

GetCachedFile

private static android.graphics.Bitmap GetCachedFile(android.content.Context c,
                                                     java.net.URL url)
Load the image from the file cache if possible. If not available, download the image from the server and cache it locally. This method is synchronized because if the same image is requested multiple times it is downlaoded and cached multiple times. In the production release this will likely not be necessary since every image that is loaded on a single screen will be different.

Parameters:
c - The context which is used to get the file cache.
url - The URL of the remote image.
Returns:
The requested image.

GetRemoteFile

private static android.graphics.Bitmap GetRemoteFile(java.net.URL url)
Load the image from the remote URL.

Parameters:
url - The remote URL.
Returns:
The requested image.

Revision: 109 Generated on Sat Dec 10 07:00:03 UTC 2011