I have a problem to test my non activity-class which need the context of a activity class.
The class Card extends ImageView and have a few methods:
public class Card extends ImageView {
public Card(Context context, int cardID) {
super(context);
this.cardID = cardID;
this.turnback = 0;
backImage = getResources().getDrawable(R.drawable.backimage);
setBackgroundDrawable(backImage);
}
}
I would like to test this class as a standalone class, is there an opportunity to create an Dummy Context?
The simple answer is no. The reason being that you are extending a view. The only way to test a view is to view it. To do that you need an activity. This is android fundamentals.