Airpush classes cannot be created

Eclipse Graphical Layout and my error

I downloaded the AirPush Bundle SDK 1.0 because I want to add banner ads to my application. I imported sdk to my project and I added rules to my manifest.

However, when I run my program, I see no ads.

Every time in the layout manager it says "cannot be created" as shown in my screenshot above.

I tried deleting google play services and reloading it into the project, but nothing changed.

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

      

+3


source to share


1 answer


Send this to your developers, they should be missing a few things in their class and draw something for developers to see if active editMode

as the error says. You can't do much if you don't have access to 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);
    }
}

      

+1


source







All Articles