I'm having issues getting this to work. I'm not quite sure why... I keep getting the error:
Error occurred on line: 25 (Youtube)
java.lang.NullPointerException: Attempt to invoke virtual method 'void anywheresoftware.b4a.objects.YouTubeStandalonePlayerWrapper.Initialize(java.lang.String)' on a null object reference
at nesscorporation.apk.youtube._activity_create(youtube.java:478)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at nesscorporation.apk.youtube.afterFirstLayout(youtube.java:100)
at nesscorporation.apk.youtube.access$100(youtube.java:17)
at nesscorporation.apk.youtube$WaitForLayout.run(youtube.java:78)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
** Activity (youtube) Resume **
This is my code:
Code:
Sub Globals
Dim YouTube As YouTubeStandalonePlayer
End Sub
Sub Activity_Create(FirstTime As Boolean)
YouTube.Initialize("YouTube") ****This is the error line****
If YouTube.CheckPlayerSupported <> "SUCCESS" Then
Msgbox("YouTube service not available: " & CRLF & YouTube.CheckPlayerSupported, "")
Else
Activity.AddMenuItem3("Play Video", "PlayVideo", Null, True)
End If
End Sub
Sub PlayVideo_Click
YouTube.StartVideo("AIzaSyA-blahdyblahblahblah", _
"sKJmy7wQhns", 0, True, True)
End Sub
Sub YouTube_Result (Message As String)
Log("Result = " & Message)
End Sub
There's nothing different that I can see between the code Erel gave us and mine... am I missing something? I've got the libraries there, plus the api.jar, but I'm lost...
Cheers for the help!