I am trying to call the public void onCreate(Bundle savedInstanceState) method using plugin cordova-plugin-ace but I am getting the run time exceptions..
cordova.js:314 Uncaught Error: Native error: java.lang.RuntimeException: Error in FullscreenVlcPlayer.onCreate: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference at run.ace.Utils.invokeMethodWithBestParameterMatch(Utils.java:378) at run.ace.Utils.invokeMethod(Utils.java:253) at run.ace.IncomingMessages.invoke(IncomingMessages.java:214) at run.ace.NativeHost$2.run(NativeHost.java:242) 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:5930) 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:1405) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Following is my angularJs code for invoking the Oncreate method.
if (window.ace.platform == "Android"){
var canvas = new window.ace.Canvas();
var bundle = new ace.NativeObject("android.os.Bundle");
var obj = new ace.NativeObject("FullscreenVlcPlayer");
obj.invoke("onCreate",bundle );
canvas.getChildren().add(obj);
``` var popup = new ace.Popup();
popup.setPosition(50, 20);
popup.setRect({x: 50, y: 20, width: 200, height: 200});
popup.setContent(obj);
}
`
Following is my java class.
FullscreenVlcPlayer.java
`
public class FullscreenVlcPlayer extends Activity implements SurfaceHolder.Callback, IVideoPlayer {
private String urlToStream;
private LinearLayout vlcContainer;
private SurfaceView mSurface;
private SurfaceHolder holder;
private FrameLayout vlcOverlay;
private ImageView vlcButtonPlayPause;
private Handler handlerOverlay;
private Runnable runnableOverlay;
private Handler handlerSeekbar;
private Runnable runnableSeekbar;
private SeekBar vlcSeekbar;
private TextView vlcDuration;
private TextView overlayTitle;
private LibVLC libvlc;
private int mVideoWidth;
private int mVideoHeight;
private final static int VideoSizeChanged = -1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
urlToStream = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";// b.getString("url", null);
getActionBar().hide();
// SETUP THE UI
try{
getActionBar().hide();
setContentView(R.layout.activity_fullscreen_vlc_player);
}catch(Exception e){
Log.d("TAG", "error");
}
// VLC
vlcContainer = (LinearLayout) findViewById(R.id.vlc_container);
mSurface = (SurfaceView) findViewById(R.id.vlc_surface);
// OVERLAY / CONTROLS
vlcOverlay = (FrameLayout) findViewById(R.id.vlc_overlay);
vlcButtonPlayPause = (ImageView) findViewById(R.id.vlc_button_play_pause);
vlcSeekbar = (SeekBar) findViewById(R.id.vlc_seekbar);
vlcDuration = (TextView) findViewById(R.id.vlc_duration);
overlayTitle = (TextView) findViewById(R.id.vlc_overlay_title);
// overlayTitle.setText("rtsp://172.22.68.96:21212/Stream-2");
// AUTOSTART
playMovie();
}
}
This is not full code there are my more method but I cant put all.
Please give me some Idea How to call any Class onCreate method from plugin In angular Js.
I am trying to call the public void onCreate(Bundle savedInstanceState) method using plugin cordova-plugin-ace but I am getting the run time exceptions..
cordova.js:314 Uncaught Error: Native error: java.lang.RuntimeException: Error in FullscreenVlcPlayer.onCreate: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference at run.ace.Utils.invokeMethodWithBestParameterMatch(Utils.java:378) at run.ace.Utils.invokeMethod(Utils.java:253) at run.ace.IncomingMessages.invoke(IncomingMessages.java:214) at run.ace.NativeHost$2.run(NativeHost.java:242) 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:5930) 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:1405) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Following is my angularJs code for invoking the Oncreate method.