Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8401077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:42:49+00:00 2026-06-09T21:42:49+00:00

I have a webview with javascript-interface. From within this webview i do certain javascript

  • 0

I have a webview with javascript-interface.

From within this webview i do certain javascript operations.

In one of those i set an onclick attribute for one of the elements in my webcontent. ( using jquery)

button.attr("onclick", "Android.doStuff(".concat(stringContainingOnlyNumbers).concat(")"));

As you might guess the variable stringContainingOnlyNumbers holds a String containing only numbers.

Android is the keyword for my javascript-interface.

If i click the button i manipulated the method doStuff is gettin called on the interface.

Everything fine so far.

But what the String Parameter holding looks like a float value.

So what looks like this on js side:

1344810353

Comes out on my interface like this:

1.34447e+09

Can anyone help me out here and explain why this conversion happens?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:42:50+00:00Added an answer on June 9, 2026 at 9:42 pm

    That isn’t really a conversion, it’s just rewriting it to fewer decimal digits using scientific notation.
    1344810353 rounded to 6 digits is 1.34447e+09, which btw is 1.34447 * 10^9.

    It’s a float, and javascript tends to shorten numbers when concatenating them as strings.
    Here’s an example: http://jsfiddle.net/YGC8B/

    You can fix this by iterating through the numbers digits and displaying them one by one.

    function getString(number) {
        var numstring = "";
        var num = number;
        while (num > 0) {
            numstring = num % 10 + numstring;
            num -= num % 10;
            num /= 10;
        }
        return numstring;
    }
    var number = 1344810353;
    log(getString(number)); // or however your output it
    

    Here’s a working example: http://jsfiddle.net/Tj5Zy/

    A side note:

    It’s best not to use the onclick attribute of an element, it’s slightly deprecated. I would recommend attaching the event.
    And since you’re using jQuery, it’s just all the easier.

    button.bind('click',function() {
        Android.doStuff(stringContainingOnlyNumbers);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added a JavaScript Interface to WebView. I am able to use all
I have added a Javascript interface object to a WebView using the addJavascriptInterface() method
I have a WebView with data populated from local javascript (in the asset folder).
I have a webview which will load from file or from the web. I
I have a webview which I would like to remove the elasticity from. As
I have a WebView. I'd like to show some page from my server, but
Within a Cocoa application I have a webview. When Google's personalized home page loads
I've got WebView, JS code inside it. Also I have interface to allow Java
I have a WebView and the it loads a html page which has javascript
I have this much javascript <p> <label style=top:16px for=<%= ClientName.ClientID %>>Client Name</label> <so:BoundSOTextBox autocomplete=off

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.