Re: [codenameone-discussions] Re: USB Serial Communication

2017-01-25 Thread Shai Almog
Hi, I'm sure that would be interesting to some developers. If you can convert it to a cn1lib I can walk you thru the steps of doing that and submitting it to our extensions UI via a pull request: http://github.com/codenameone/CodenameOneLibs/ -- You received this message because you are

Re: [codenameone-discussions] Re: USB Serial Communication

2017-01-25 Thread ramalho . david
Hello Shai, Thank you so much for your help. I was finally able to make it work. Now I have an app developed with Codename1 communicating with other devices, such as Arduino, through USB with serial communication. If you think it's interesting I can prepare a sample so it can be shared with

Re: [codenameone-discussions] Re: USB Serial Communication

2017-01-24 Thread Shai Almog
Hi, Use: import com.codename1.impl.android.AndroidNativeUtil; Then use: AndroidNativeUtil.getActivity().getApplicationContext() -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving

Re: [codenameone-discussions] Re: USB Serial Communication

2017-01-24 Thread ramalho . david
Hi Shai, Thanks, the callback from Native Interface worked! Now I'm having trouble with some of the functions that worked in the Android version, but are not working in CN1 with the Native Interface. This one for example: PendingIntent pi = PendingIntent.getBroadcast(getApplicationContext(),

Re: [codenameone-discussions] Re: USB Serial Communication

2017-01-12 Thread Shai Almog
Hi, runOnUIThread runs on the Android native UI thread which is different from the Codename One EDT. Since I have no knowledge of your app I can't really tell you how to find your text area but you can just keep it in a static variable and change it in the Codename One side. Just make sure that

Re: [codenameone-discussions] Re: USB Serial Communication

2017-01-12 Thread David Ramalho
Hi Shai, I could callback from Native code to CN1 side, creating a new class like NativeCallback from the example. The problem is that I couldn't access the text field from the NativeCallback class. I can only access text field within the StateMachine class (ex:

[codenameone-discussions] Re: USB Serial Communication

2017-01-10 Thread Shai Almog
Hi, you can use your own thread in native code without a problem. You can just use your existing Android code for the most part. Instead of setting a text field from native just do a callback with a String from native to the Codename One side. There is a sample of that in the developer guide

[codenameone-discussions] Re: USB Serial Communication

2017-01-10 Thread ramalho . david
Hi Shai, Thanks for the information. I'm implementing using native interface. The app needs to open a Serial connection through USB and wait for a message from the connected device. When I program in Android Studio, I use an independent thread to verify the incoming messages and update a

Re: [codenameone-discussions] Re: USB Serial Communication

2017-01-10 Thread David Ramalho
Hi Shai, Thanks for the information. I'm implementing using native interface. The app needs to open a Serial connection through USB and wait for a message from the connected device. When I program in Android Studio, I use an independent thread to verify the incoming messages and update a EditText

[codenameone-discussions] Re: USB Serial Communication

2016-12-09 Thread Shai Almog
Hi, no. You could use native interfaces to do that but I have no personal experience with doing USB on Android/iOS. https://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html -- You received this message because you are subscribed to the Google