In my project, I have a class that in this class I want to have access to image properties. But I do not want to show it through this class. In this class, I just want to know the width and height of the image and perform some mathematical functions in order to return something.
My problem is that I do not know how to turn to this picture. My photo is in a folder with a choice. The code I wrote is the problem: image = (ImageView) findViewById (R.id.imViewRaw);
import android.view.View;
import android.widget.ImageView;
public class Stego
{
private ImageView image;
private int imWidth, imHeight;
public Stego()
{
image = (ImageView)findViewById(R.id.imViewRaw);
image.setImageResource(R.drawable.tasnim);
imWidth = image.getWidth();
imHeight = image.getHeight();
}
public int getImageWidth(){
return imWidth;
}
public int getImageHeight(){
return imHeight;
}
public int getMaxMessageChars(){
int i = imWidth * imHeight;
i *= 3;
i /= 4;
return i;
}
}
source
share