How to get that working:
if(findViewById(ResIdWithUnkownType) instanceof Bitmap)
{
Bitmap bitmap = (Bitmap) findViewById(ResIdWithUnkownType);
} else if(findViewById(ResIdWithUnkownType) instanceof ImageView)
{
ImageView = (ImageView) findViewById(ResIdWithUnkownType);
}
final View view=FLall. getChildAt(i); if (view. getType()==ImageView) { ... }
View is a basic building block of UI (User Interface) in android. A view is a small rectangular box that responds to user inputs. Eg: EditText, Button, CheckBox, etc. ViewGroup is an invisible container of other views (child views) and other ViewGroup.
A View occupies a rectangular area on the screen and is responsible for drawing and event handling. Views are used for Drawing Shapes like Circles,Rectangles,Ovals etc . Just Use View with background and apply a Shape using Custom Drawable.
Tags are essentially an extra piece of information that can be associated with a view. They are most often used as a convenience to store data related to views in the views themselves rather than by putting them in a separate structure. Reference: http://developer.android.com/reference/android/view/View.html.
The second block would work just fine. The problem is the first one: findViewById
returns a View
object always, and Bitmap
is not a View
, so the first if
statement will never be executed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With