title: How to call a javascript function from android fragment?
body: <p>I have a webview in a fragment and have my own Bridgecallback services.</p>
  
  <p>I have a javascript file <strong><em>TriggerEventsService.js</em></strong></p>
  
  <pre><code>define(function(require){
  
      var Service = require('BridgeService');
      var TriggerEventsService = new Service({
          name: "TriggerEventsService",
          timeout : 3000
      });
  
      //Public API
      TriggerEventsService.postHibernate = function(){
          this.execute("postHibernate", {"event" : "App becoming inactive"}, function(){}, function(){});
      };
  </code></pre>
  
  <p>In my HTML file <strong><em>index.html</em></strong></p>
  
  <pre><code>  function postEventHibernate(){
              require(['TriggerEventsService'], function(ui){
                  ui.postHibernate();
              });
          }
  </code></pre>
  
  <p>Can I call this function directly from native android methods ?</p>
  
  <p>In <strong>iOS</strong> I have done this:</p>
  
  <pre><code>    NSString *jsString = [NSString stringWithFormat:@"require(['TriggerEventsService'],
   function(ui){ui.postHibernate();});"];
               [self.webView evaluateJavaScript:jsString completionHandler:nil];
  </code></pre>
  
  <p>and <strong><em>It works fine</em></strong> !I know a way to do it in iOS , figuring anyone can help me out if android has any direct method ?</p>
  
  <p>I have seen other Answers but was not sure how to call the my TriggerEventsService.js - <em>webview.loadUrl</em>("<strong>WHAT EXACTLY SHOULD I CALL HERE ?</strong>");</p>