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

  • SEARCH
  • Home
  • 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 8192633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:13:24+00:00 2026-06-07T04:13:24+00:00

I was using Android 4.0.3+JQM+Phonegap without having troubles. Yesterday I tested on Android 4.1

  • 0

I was using Android 4.0.3+JQM+Phonegap without having troubles. Yesterday I tested on Android 4.1 and found that those dynamically generated ListView would sometimes give me duplicated results. For example, I use the following code to generate a ListView to show today’s date:

<ul data-role="listview" data-inset="true" data-theme="c" 
data-divider-theme="d" id="todayvalue">             
</ul>


document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
var today = new Date();
var dayofmonth = today.getDate();
var dayofweek = today.getDay();
var year = today.getFullYear();
var month = today.getMonth();
var myDays=      ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
var m_names = ["January", "February", "March", 
    "April", "May", "June", "July", "August", "September", 
    "October", "November", "December"];
$('#todayvalue').append('<li>Today is '+ myDays[dayofweek]+ ', '+year+'-'+m_names[month]+'-'+dayofmonth+'</li>');
$('#todayvalue').listview('refresh');


 }

It used to have no problem at all. But now it would generate two identical rows.

Whom to blame?

Update: I have uploaded the project to https://github.com/ysongfinance/520Toll.

After further debugging, I found that onDeviceReady() was called twice but one of them looks weird:

07-05 20:42:31.368: I/Web Console(825): ########in OndeviceReady at file:///android_asset/www/js/updatetoll.js:4
07-05 20:42:31.488: I/Web Console(825): ########in OndeviceReady at null:4

Look at the second call “in OndeviceReady at null”, what does that “null” suppose to mean?

  • 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-07T04:13:25+00:00Added an answer on June 7, 2026 at 4:13 am

    I tried your example with Cordova 1.9 and Android 2.2 and it was firing deviceready twice.

    Then I moved the updatetoll.js included in body to head and it fires only once.

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <title>520 Toll Rate</title>
            <link rel="stylesheet" href="css/jquery.mobile-1.0.1.min.css" /> 
    
            <script src="js/jquery-1.6.4.min.js"></script> 
            <script src="js/jquery.mobile-1.0.1.min.js"></script>
    
            <script type="text/javascript" charset="utf-8" src="js/cordova-1.9.0.js"></script>
            <script src="js/updatetoll.js"></script>        
        </head>
        <body>      
            <div data-role="header">                
                    <img src="logo/ic520toll.png" width=50px height=50px style="margin-left: 40%;"">            
            </div>
            <div data-role="content">
            <ul data-role="listview" data-inset="true" data-theme="c" 
                data-divider-theme="d" id="todayvalue">             
            </ul>           
    
            </div>  
    
        </body>
    </html>
    

    Can you check this change and see does it work in your device.

    Edit

    jQuery Mobile seems to create the problem if you put the listener outside of the head tag. I tried the newer version of jQuery Mobile (1.1.0) but the affect is still the same.

    If you remove the jQuery Mobile and keep your code as it is then it will fire only once.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i found that when using android TabActivity to open tabs where each tab is
I have been using phonegap.js with jqm to built a mobile android app. I
I have an application developed on iOS & Android using phonegap 1.6.0 & JQM
I've packaged my JQM App using phoneGap (android & ios). It works fine, but
I have a phonegap app that uses jqm that works fine in android and
I am using android 2.2, phonegap 1.3, and jquery-mobile 1.0 I have a list
I am using android ndk, and for that I am trying to create a
I'm using android 3.0 and I try to create bitmap xml that will create
I'm using Android-Query for the first time and I understand that it (takes care
I am using android compatibility library, and I am having some problems with listfragments

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.