thalsharif
thalsharif

Reputation: 357

Bitmap vs ImageView vs Drawable

What is the different between them?

where and why we need to convert from one type to another?

Upvotes: 8

Views: 6049

Answers (2)

CopsOnRoad
CopsOnRoad

Reputation: 267734

Bitmap actually refers to the Images like png, jpg, etc.

ImageView is a view that is used to display an image. You can call

imageView.setImageBitmap(your_bitmap) // displays your bitmap 
imageView.setImageDrawable(your_drawable) // displays your drawable
imageView.setImageResource(R.drawable.your_drawable_file) // displays drawable from resource
imageView.setImageURI(Uri_here) // displays from Uri

Drawable is something that can be drawn like layout, vector, image, etc.

Upvotes: 0

antoniom
antoniom

Reputation: 3241

For a difference between bitmap and drawable see here

ImageView is something like img tag in HTML. It is the View that displays an image.

Upvotes: 1

Related Questions