Coder Social home page Coder Social logo

Comments (5)

JonShemitz avatar JonShemitz commented on August 22, 2024

If you pass your GVRActivity to the scriptโ€™s constructor, you can call Activity methods like runOnUiThread() from your script.

From: DanielNogueiraAndroid [mailto:[email protected]]
Sent: Friday, May 22, 2015 12:00 PM
To: Samsung/GearVRf
Subject: [GearVRf] SpeechRecognizer should be used only from the application's main thread on GVRScript (#69)

It is possible to run on a class that extends from GVRScript, some code that going to run on main Thread ?
I'm trying to run this code:
"SpeechRecognizer.createSpeechRecognizer(gvrContext.getContext());"
this is the error:
java.lang.RuntimeException: SpeechRecognizer should be used only from the application's main thread

โ€”
Reply to this email directly or view it on GitHubhttps://github.com//issues/69.

from gearvrf.

DanielNogueiraAndroid avatar DanielNogueiraAndroid commented on August 22, 2024

Ok it works !!!
You have any idea how to do that if i need to call this code:
"SpeechRecognizer.createSpeechRecognizer(gvrContext.getContext());"
inside a class that extends from GVRSceneObject ?
without pass GVRActivity as parameter (avoiding to have instance of GVRActivity inside GVRSceneObject)
something like gvrContext.runOnGlThread but for MainThread

from gearvrf.

JonShemitz avatar JonShemitz commented on August 22, 2024

without pass GVRActivity as parameter (avoiding to have instance of GVRActivity inside GVRSceneObject) like gvrContext.runOnGlThread but for MainThread

We're having a slow-motion internal discussion about exposing the GVRActivity via GVRContext. One of the changes I made very early on was changing GVRContext.getContext() to return the ApplicationContext, not the Activity. This was robotic, Android 101 thinking on my part: You don't hold onto an Activity because that can be a huge memory leak. But GVRF has turned out to be very single-Activity, and we'll probably

  1. Let GVRContext.getContext() return the GVRActivity, as a Context.
  2. Add a new GVRActivity GVRContext.getActivity() that will give you access to all the Activity methods.

from gearvrf.

DanielNogueiraAndroid avatar DanielNogueiraAndroid commented on August 22, 2024

Great !!!

from gearvrf.

JonShemitz avatar JonShemitz commented on August 22, 2024

Pull request #80

from gearvrf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.