hey can you help me with that
how can i read text from nfc tag in my app
]]>When I reload the screen, I am able to clear TextInut, but not able to REFOCUS, help me to fix my following code?
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
Builder.load_string(”’
:
BoxLayout:
orientation: ‘vertical’
BoxLayout:
BoxLayout:
TextInput:
id: Image_Input
multiline: False
focus: True
on_text_validate: Image_Input.focus=True
Button:
on_press:Image_Input.focus=True
text: ‘RELOAD’
on_press: root.reload(); Image_Input.text=”
”’)
class MainScreen(Screen):
def reload(self):
print(“screen reloaded”)
pass
class TestApp(App):
def build(self):
# Create the screen manager
screenManager = ScreenManager()
screenManager.add_widget(MainScreen(name=’main’))
return screenManager
if __name__ == ‘__main__’:
TestApp().run()
Here is full working example, http://pastebin.com/8avhuksU . I finally managed solve my problem to read NFC, thanks to Stackoverflow….
I prepared that example from all pieces which was around internet.
In buildozer you don’t need intent filter if you just read NFC when your program is active. Here is modifications for default buildozer file which I have:
source.include_exts = py,png,jpg,kv,atlas,pyc
# (list) Permissions
android.permissions = NFC
# (int) Android API to use
android.api = 19
# (int) Minimum API required
android.minapi = 14
# (int) Android SDK version to use
android.sdk = 24
# (str) Android NDK version to use
android.ndk = 10d
#android.manifest.intent_filters = nfc_filter.xml
]]>”’self.scan_entry.bind(focus=on_focus)
def on_focus(textInstance,isFocus):
print self.scan_entry
if not isFocus: self.scan_entry.Focus = True”’
this should also trigger on enter if multiline is false
]]>Hopefully I haven’t missed something incredibly simple somewhere, but I did just start using Kivy about a week ago.
Thank you in advance for any information you can share!
]]>