How can i do this?
something:
final View view=FLall.getChildAt(i); if (view.getType()==ImageView) { ... }
final View view=FLall. getChildAt(i); if (view. getType()==ImageView) { ... }
For example, if the View contains text, use this: ( (TextView) view ). getText(). toString();
findViewById returns an instance of View , which is then cast to the target class. All good so far. To setup the view, findViewById constructs an AttributeSet from the parameters in the associated XML declaration which it passes to the constructor of View . We then cast the View instance to Button .
FindViewById<T>(Int32)Finds a view that was identified by the id attribute from the XML layout resource.
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 ...
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