首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >构造函数StarBitmap(位图、布尔值、int)不可见

构造函数StarBitmap(位图、布尔值、int)不可见
EN

Stack Overflow用户
提问于 2014-06-05 05:50:04
回答 1查看 320关注 0票数 0

有人知道如何修复这个错误吗?构造函数StarBitmap(位图、布尔值、int)不可见。这种情况发生在代码的第二行:

代码语言:javascript
复制
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是这样的:

代码语言:javascript
复制
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开发的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-05 05:54:23

您已经使用了构造函数starBitmap()的默认可见性。默认可见性允许同一包中的可访问性。但是,如果您想通过不同的包访问成员,则应该是公开的。有关更多信息,请参考链接In Java, difference between default, public, protected, and private

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24052537

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档