The event can be null if the operation is canceled.
Codename One - Video Capture
-
17-07-2023 - |
Pergunta
Am using codename one to capture the video and upload it to Vimeo. But I get errors when I click the button. What am I doing wrong ?
I get below error when the method is called. I have a camera java.lang.NullPointerException at userclasses.StateMachine$1.actionPerformed(StateMachine.java:63)
protected void onMain_Button1Action(Component c, ActionEvent event) {
Capture.captureVideo(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if(Capture.hasCamera()){
System.out.println("I have a camera");
}else{
System.out.println("I don't have a camera");
}
try {
String path = (String) evt.getSource();
Log.p("Path->" + path);
Vimeo.MyVimeo(path);
is.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
}
Solução
Outras dicas
You are not meant to select a file, The capture class is for capturing media files from the device. It brings out FileChooser if you are using the emulator, therefore test it on a device and see how it works.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow