Created
June 15, 2015 18:24
-
-
Save udacityandroid/bd550cc8fd37190d85a6 to your computer and use it in GitHub Desktop.
Android for Beginners : Simplified ImageView class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Displays an image, such as an icon. | |
*/ | |
public class ImageView extends View { | |
// Resource ID for the source image that should be displayed in the ImageView. | |
private int mImageId; | |
// Context of the app | |
private Context mContext; | |
/** | |
* Constructs a new ImageView. | |
*/ | |
public ImageView(Context context) { | |
mImageId = 0; | |
mContext = context; | |
} | |
/** | |
* Sets the source image in the ImageView. | |
* | |
* @param imageId is the resource ID of the image to be displayed. | |
*/ | |
public void setImage(int imageId) { | |
mImageId = imageId; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Was here!