newTextField text get value doesnt work on android version 2012.971

exemple:
ttextField = native.newTextField(0, 100, 200, 30);
ttextField.text=“hola”
print(ttextField.text) [import]uid: 179968 topic_id: 33246 reply_id: 333246[/import]

Have you filed a bug report using the “Report a Bug” link at the top?
[import]uid: 19626 topic_id: 33246 reply_id: 132125[/import]

Done.
I did not see that about report a bug.
Thanks [import]uid: 179968 topic_id: 33246 reply_id: 132129[/import]

Have you filed a bug report using the “Report a Bug” link at the top?
[import]uid: 19626 topic_id: 33246 reply_id: 132125[/import]

Done.
I did not see that about report a bug.
Thanks [import]uid: 179968 topic_id: 33246 reply_id: 132129[/import]

Reading and writing text to a TextField and TextBox does actually work… but there is one dirty little secret. Corona apps on Android are actually multithreaded where your Lua script is running on one thread and the UI (such as your TextField) is running on another thread. So, when you set the TextField’s text as follows…
[lua]textField.text = “hello”[/lua]
…the text does not get applied to the TextField immediately. Instead, we queue a request to change the TextField on the UI thread which will get executed later, right after your Lua script has been executed.

So, you can work-around this by not reading a TextField’s text right after setting it. Just store the string to a local variable instead.

That said, I think it’s fair to call this a bug. What we should do is keep a copy of the native field’s data, make the data available to all threads, and keep the data in sync with the UI. Not a simple thing to set up for sure (it’s a lot of work), but we’ve done this with all of our other newest native object features in Android such as the WebView and MapView.
[import]uid: 32256 topic_id: 33246 reply_id: 132628[/import]

Reading and writing text to a TextField and TextBox does actually work… but there is one dirty little secret. Corona apps on Android are actually multithreaded where your Lua script is running on one thread and the UI (such as your TextField) is running on another thread. So, when you set the TextField’s text as follows…
[lua]textField.text = “hello”[/lua]
…the text does not get applied to the TextField immediately. Instead, we queue a request to change the TextField on the UI thread which will get executed later, right after your Lua script has been executed.

So, you can work-around this by not reading a TextField’s text right after setting it. Just store the string to a local variable instead.

That said, I think it’s fair to call this a bug. What we should do is keep a copy of the native field’s data, make the data available to all threads, and keep the data in sync with the UI. Not a simple thing to set up for sure (it’s a lot of work), but we’ve done this with all of our other newest native object features in Android such as the WebView and MapView.
[import]uid: 32256 topic_id: 33246 reply_id: 132628[/import]

ok, Thanks, thought it was not very normal that just happen on android, with local variable is enough [import]uid: 179968 topic_id: 33246 reply_id: 132819[/import]

ok, Thanks, thought it was not very normal that just happen on android, with local variable is enough [import]uid: 179968 topic_id: 33246 reply_id: 132819[/import]

I have something very similar, but I’m not sure it is a bug or me and would appreciate any feedback. When I try using native.newTextField on Android devices, the textfield does not appear. It works in the simulator, but not the device. The specific code is:

item=native.newTextField(200,200,220,36)

item.inputType=“default”

This seemed very similar to original post so I posted here rather than create a new thread. Any feedback would be appreciated.

Thanks!

-Update: The sample app, NativeKeyboard2, does work on my Android devices. This being the case, there must be something I am doing wrong somewhere. When I find the solution to my issue, I’ll update this so that it may help someone else. Of course if someone else has an idea, I’m all ears.

I have something very similar, but I’m not sure it is a bug or me and would appreciate any feedback. When I try using native.newTextField on Android devices, the textfield does not appear. It works in the simulator, but not the device. The specific code is:

item=native.newTextField(200,200,220,36)

item.inputType=“default”

This seemed very similar to original post so I posted here rather than create a new thread. Any feedback would be appreciated.

Thanks!

-Update: The sample app, NativeKeyboard2, does work on my Android devices. This being the case, there must be something I am doing wrong somewhere. When I find the solution to my issue, I’ll update this so that it may help someone else. Of course if someone else has an idea, I’m all ears.