Android get type of a view

If, for some strange reason, you can’t use Asahi‘s suggestion (using tags), my proposition would be the following:

if (view instanceof ImageView) {
    ImageView imageView = (ImageView) view;
    // do what you want with imageView
}
else if (view instanceof TextView) {
    TextView textView = (TextView) view;
    // do what you want with textView
}
else if ...

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)