Skip to content

Instantly share code, notes, and snippets.

@Mohanad0
Forked from udacityandroid/ImageView.java
Created May 29, 2018 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mohanad0/8ae6a7aa0fa5c9c1d519fd96104885ad to your computer and use it in GitHub Desktop.
Save Mohanad0/8ae6a7aa0fa5c9c1d519fd96104885ad to your computer and use it in GitHub Desktop.
Android for Beginners : Simplified ImageView class
/**
* 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