hi all,i need to integrate the *ad-banner* (use the ad-mob sdk 4.1.0)
into the CandidateView of a custom soft-keyboard,i just write the code
but this not work because i have not a Activity context be passed to
the constructor of ad-banner.
This is code that I wrote:
-------------------------------
public class CandidateView extends LinearLayout {
        Context mContext;
        public CandidateView(Context context) {
                super(context);
                mContext = context;
                this.setBackgroundColor(Color.BLUE);
                
            AdView adView = new AdView((Activity) mContext, AdSize.BANNER,
"pippoplutopaperino");     <-------
            this.addView(adView);
            adView.loadAd(new AdRequest());
                        
        }
        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        }
        @Override
        protected void onDraw(Canvas canvas) {
                if (canvas != null) {
                        super.onDraw(canvas);
                }
        }
}
-------------------------------
this is a error:
Uncaught handler: thread main exiting due to uncaught exception
java.lang.ClassCastException: net.iacopodeenosee.test_AD.SoftKeyboard
at net.iacopodeenosee.test_AD.CandidateView.<init>(CandidateView.java:25)
at 
net.iacopodeenosee.test_AD.SoftKeyboard.onCreateCandidatesView(SoftKeyboard.java:118)
at 
android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1310)
at 
android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1278)
at 
android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:388)
at 
android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:148)
at 
com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:45)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)

there is some trick that I can use? thanks to all.8y3

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to