3

Eclipse Graphical Layout and my error

I dowloaded the Airpush Bundle SDK 1.0 becuase I want to add banner ads to my app. I imported the sdk to my project, and I added rules to my manifest.

However, when I run my program I do not see any ads.

Every time in the layout manager it says "could not be instantiated" as seen in my screenshot above.

I tried to delete google play services, and reload it into project, but did not change anything.

Here's the text of the error message:

The following classes could not be instantiated:
- com.bplxjxdpse.achmyqxdlf225456.AdView (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
JNYRanger
  • 6,829
  • 12
  • 53
  • 81
hakki
  • 6,181
  • 6
  • 62
  • 106

1 Answers1

1

Send this to their developers, they should be skipping a few things in their class and draw something for the developers to see if editMode is active, just like the error says. You can't do much unless you have access to the sources.

@Override
public void draw(Canvas canvas) {
    super.draw(canvas);
    if (isInEditMode()) {
        // This will be shown in XML layout design
        Paint mTitlePaint = new Paint();
        mTitlePaint.setColor(Color.BLACK);
        mTitlePaint.setStyle(Paint.Style.FILL);
        mTitlePaint.setAntiAlias(true);
        mTitlePaint.setTextSize(40);
        String mTitle = "Ad will appear here";
        float xPos = ((getMeasuredWidth() - mTitlePaint.measureText(mTitle)) / 2.0f);
        float yPos = (getMeasuredHeight() / 2.0f);
        float titleHeight = Math.abs(mTitlePaint.descent() + mTitlePaint.ascent());
        yPos += titleHeight / 2.0f;
        canvas.drawText(mTitle, xPos, yPos, mTitlePaint);
    }
}
Bojan Kseneman
  • 15,488
  • 2
  • 54
  • 59