Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Using JavaScript for an Android App

Options
  • 12-11-2014 10:38pm
    #1
    Registered Users Posts: 1,453 ✭✭✭


    I'm using AndroidStudio. Can Javascript be used to dynamically change things when writing Android apps or is there another way?


Comments

  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Sheepy99 wrote: »
    I'm using AndroidStudio. Can Javascript be used to dynamically change things when writing Android apps or is there another way?
    Change what things? Be a little more specific.


  • Registered Users Posts: 86 ✭✭maxmarmalade


    Sheepy99 wrote: »
    I'm using AndroidStudio. Can Javascript be used to dynamically change things when writing Android apps or is there another way?

    you can write javascript apps then wrap them using phonegap to work as an android (or iOS or Windows) app


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    you can write javascript apps then wrap them using phonegap to work as an android (or iOS or Windows) app
    The OP is using AndroidStudio.


  • Registered Users Posts: 86 ✭✭maxmarmalade


    The OP is using AndroidStudio.

    Android Studio works great for javascript debugging of android apps. For actual writing of the js code, i'd use something like Aptana.


  • Registered Users Posts: 511 ✭✭✭D Hayes


    If you're using AndroidStudio then you're probably doing native app development, i.e. using Java. You can't use JavaScript here, but you can still replicate JS/Ajax style features (like dynamically displaying search box suggestions) in the Java code. The Android Developer Guide gives excellent examples.


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    D Hayes wrote: »
    If you're using AndroidStudio then you're probably doing native app development, i.e. using Java. You can't use JavaScript here, but you can still replicate JS/Ajax style features (like dynamically displaying search box suggestions) in the Java code. The Android Developer Guide gives excellent examples.
    From what they actually wrote, I don't think the OP was looking for that or which IDE to use and I suspect that when they posted their question they didn't even know that Android Studio is a native (Java) development IDE, given other posts elsewhere. This is why I asked for more information.

    If they were asking is it possible to use JavaScript for your business logic and "dynamically change things" on the native device, then yes but it would also require writing a 'bridge' between an embedded browser and the native code so that your JavaScript can trigger native methods or native events can interact in return. For that you'd want to look at setting a custom WebViewClient class that would allow for methods such as shouldOverrideUrlLoading.

    Still, they've not come back to reply in close to a week, so at this stage I suspect this is all a moot point.


Advertisement