Hi all,
I'm trying to use the tencentad sdk and I'm having some difficulties.
the problem is how to using b4a code to initialize AAR class with listener parameter
here is sdk demo java code SplashActivity.java
And I have init sdk,and test it is initial OK.
Next I need initial SplashAD. here I'm in trouble, because splash initial function need a panel and a listener as its parameter.
I have been looking for a long time in the forum, and there is no similar code for my reference.
Can anyone help me? Any help is welcome. Thanks.
ERR MESSAGE:
Error occurred on line: 220 (Main)
java.lang.RuntimeException: Constructor not found.
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:95)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at com.qq.e.union.demo.main._initial_load_splash(main.java:622)
at com.qq.e.union.demo.main$ResumableSub_Activity_Create.resume(main.java:557)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1704)
at android.os.Handler.handleCallback(Handler.java:809)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7555)
I'm trying to use the tencentad sdk and I'm having some difficulties.
the problem is how to using b4a code to initialize AAR class with listener parameter
here is sdk demo java code SplashActivity.java
And I have init sdk,and test it is initial OK.
B4X:
Sub InitialGDTADManager
'ref java code:
'GDTADManager.getInstance().initWith(applicationContext, "APPID");
If Flag_GDTADManager_Initial = False Then
Log("GDTADManager Init")
GDTADManager = GDTADManager.InitializeStatic("com.qq.e.comm.managers.GDTADManager").RunMethod("getInstance",Null)
GDTADManager.RunMethod("initWith",Array(NativeMe,"1101152570")) '1101152570 demo appid
Flag_GDTADManager_Initial = True
End If
Dim flag As Boolean = False
flag = GDTADManager.RunMethod("isInitialized",Null)
Log("GDTADManager Init : "&flag)
End Sub
Next I need initial SplashAD. here I'm in trouble, because splash initial function need a panel and a listener as its parameter.
I have been looking for a long time in the forum, and there is no similar code for my reference.
Can anyone help me? Any help is welcome. Thanks.
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private SplashAD As JavaObject
Private SplashADListener As JavaObject
end sub
B4X:
Sub Initial_Load_Splash
'SplashAD(Activity activity, View skipContainer, String posId, SplashADListener adListener, int fetchDelay)
'ref java code:
'splashAD = new SplashAD(activity, skipContainer, posId, adListener, fetchDelay);
'Splash : com.qq.e.ads.splash.SplashAD
'SplashADListener : com.qq.e.ads.splash.SplashADListener
'activity : B4A main activity
'skipContainer : B4A pnl_skip
'posId : "8863364436303842593" demo splash id
'fetchDelay : 0
SplashADListener.InitializeStatic("com.qq.e.ads.splash.SplashADListener")
SplashAD.InitializeNewInstance("com.qq.e.ads.splash.SplashAD",Array(Activity,pnl_skip,"8863364436303842593",SplashADListener,0)) '---ERR
End Sub
ERR MESSAGE:
Error occurred on line: 220 (Main)
java.lang.RuntimeException: Constructor not found.
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:95)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at com.qq.e.union.demo.main._initial_load_splash(main.java:622)
at com.qq.e.union.demo.main$ResumableSub_Activity_Create.resume(main.java:557)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1704)
at android.os.Handler.handleCallback(Handler.java:809)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7555)
Attachments
Last edited: