How to instance an ImageView from a class?
Sorry for bugging you again, but how do I instance an ImageView ( or any other layout element ) from a class?
For example, in Activity I can simply write ImageView iv = new ImageView(this); , bu开发者_StackOverflow中文版t what should I place instead of "this" if I'm instancing it from a class?
Thanks!
Eventually you'd place your view in an activity, right?
So you could pass the Activity instance as an object when creating the view.
class YourClass {
void createView(Activity activity) {
ImageView iv = new ImageView(activity);
} }
精彩评论