I have a class called crate where i would like to find the height and width. to do this I am using:
public class Crate {
public int acrossCrate;
public int upDownCrate;
public Crate(Context context) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;
}
}
But I have another class called draw which calls the crate class, and when i use the Context context in crate it gives an error when calling it in the draw class:
public class Draw extends View {
float x, y;
Paint red = new Paint();
Paint green = new Paint();
Paint black = new Paint();
Paint blue = new Paint();
Bitmap player;
Bitmap crate;
int rectSide = 1000;
Player thePlayer = new Player();
Crate theCrate = new Crate();//<-- ERROR when i use Context context
Im really stuck and if anyone knows how to do this and could help me that would be great.