Click here to Skip to main content
15,886,362 members

Comments by Nick_3141592654 (Top 34 by date)

Nick_3141592654 29-Apr-17 8:53am View    
Since you already have logger support in your code (the catch block), I would suggest adding more logging within the try block, e.g. you could check whether AudioPlayer has actually started.

Better still, run your code in a debugger.

Also, are you sure that your code isn't exiting the thread before the audio has had a chance to play. You may need to do something to explicitly wait until AudioPlayer has finished playing. Without knowing more about your application environment it's impossible to say whether this may be the case - but it's something for you to think about.
Nick_3141592654 21-Apr-17 7:01am View    
You don't need jquery for this, see window.navigator: https://www.w3schools.com/js/js_window_navigator.asp
Nick_3141592654 19-Apr-17 8:01am View    
Hi Mahi, just to clarify MVC is a design "pattern" - it defines a structural model for software structure - that is applicable to very many languages. Wherever you are using OO principles you could be using MVC. The whole point of MVC is that it provides a de-coupling between classes that may otherwise get entangled. It's up to you but I do think it is very relevant to your question.
Nick_3141592654 19-Apr-17 7:50am View    
My first choice would have been XSLT. I'd be amazed if it's not already been done.

Once you have XML you can load it into a DOM and easily grab the tags that you want.

BTW with XLST you wouldn't have to go via the XML phase. You can just as easily write XSLT to directly extract the raw text that you want. Unfortunately XSLT is hard (I think so anyway) and not the most intuitive of languages, so you've a bit of a learning curve if going that way. Best option is to find a "nearly does it" solution on s/overflow and adapt it.
Nick_3141592654 19-Apr-17 7:40am View    
I would not, as a rule, recommend separating your properties and methods. Classes typically encapsulate all such related items and maintenance/code-sharing may become harder if you need to dive into separate classes to see how the whole thing works together.

It sounds as though you may be gravitating towards a Model-View-Controller (MVC) design pattern, which certainly does have value.

I use a such a pattern (MVC-inspired) in Android to achieve a clean separation of UI from business logic, and this uses a class to hold all configurable settings (as properties) along with some helper methods to deal with things like shared-preferences. (One such 'settings' class for each category of business logic, not one global class, which would be horrible.)

I would advise you to do some reading about MVC before launching into some new paradigm of your own.