有人知道如何修复这个错误吗?构造函数StarBitmap(位图、布尔值、int)不可见。这种情况发生在代码的第二行:
Bitmap bm = BitmapFactory.decodeResource(context.getResources(), R.drawable.euro_cert_black);
StarBitmap starbitmap = new StarBitmap(bm, false, 408);我不知道怎么解决这个问题。我检查了是否有StarBitmap的导入,并且确实有。尝试从我找到的一些答案中将其更改为getResource(),但仍然一无所获。我尝试将public添加到StarBitmap构造函数中,但仍然什么也没有。
我使用这个代码的类是public class Print{}。
StarBitmap和consctuctor是这样的:
public class StarBitmap
{
int[] pixels;
int height;
int width;
boolean dithering;
byte[] imageData;
public StarBitmap(Bitmap picture, boolean supportDithering, int maxWidth)
{
if(picture.getWidth() > maxWidth)
{
ScallImage(picture, maxWidth);
}
else
{
height = picture.getHeight();
width = picture.getWidth();
pixels = new int[height * width];
for(int y=0;y < height; y++)
{
for(int x=0;x<width; x++)
{
pixels[PixelIndex(x,y)] = picture.getPixel(x, y);
}
}
//picture.getPixels(pixels, 0, width, 0, 0, width, height);
}
dithering = supportDithering;
imageData = null;
}顺便提一句,StarBitmap是由星空微型打印机的sdk开发的。
发布于 2014-06-05 05:54:23
您已经使用了构造函数starBitmap()的默认可见性。默认可见性允许同一包中的可访问性。但是,如果您想通过不同的包访问成员,则应该是公开的。有关更多信息,请参考链接In Java, difference between default, public, protected, and private
https://stackoverflow.com/questions/24052537
复制相似问题