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 8966455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:01:36+00:00 2026-06-15T17:01:36+00:00

I just made simple app using JodaTime libary. It does nothing special, only calculates

  • 0

I just made simple app using JodaTime libary. It does nothing special, only calculates difference in time ( 24hour time ) and outputs that on the screen. For example difference between hour 21 and 03 is 6 hours. Nothing special and app works.

But i have a problem. When i click “calculate” button i experience some unusual delay. Its like when i click button it takes 3 seconds to “calculate” on emulator. On my phone it takes like half of second. But you can see that calculating is not instant. But when i want to calculate the second time, then it does instant with no problem. On actual phone and emulator. Can someone tell me what could be wrong? Here is my onClick code (in activity i have only references to views ). As far as i know it should be problem with objects..loading into memory? Because when they are exists in memory there is no delay. How can i improve my code so there won’t be any delay anymore?

@Override
public void onClick(View ClickedView) {

    hour1 = Integer.parseInt(field_hour1.getText().toString());
    hour2 = Integer.parseInt(field_hour2.getText().toString());



    if(hour2 < hour1) {

        dt1 = new DateTime(2012, 10, 10, hour1, 00);
        dt2 = new DateTime(2012, 10, 10+1, hour2, 00);
        diff = Hours.hoursBetween(dt1, dt2);


    } else {
        dt1 = new DateTime(2012, 10, 10, hour1, 00);
        dt2 = new DateTime(2012, 10, 10, hour2, 00);
        diff = Hours.hoursBetween(dt1, dt2);

        }


    result.setText(""+diff.getHours());}
  • 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-15T17:01:37+00:00Added an answer on June 15, 2026 at 5:01 pm

    You can try this

    public static int diff(int hour1, int hour2) {
        if(hour2 < hour1) {
            hour2 += 24;
        }
        return hour2 - hour1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just made a very simple test app using documentation from MSDN. All I
I am Making a Simple App using JavaFX UI, The app simply just do
I've made a very simple app that just displays a Google map. However, it
I've made a wxPerl application which presents just a simple frame which only contains
Hi I've made my igoogle app simple though it is basically using an xml/php
I have just made an app for Android phones. It is a rather simple
I made a simple app using backbone.js and require.js. Earlier i used to have
I've just made a really simple toggle button. Function checks the state (a class),
so I'm making some basic programming language (just for exercise). I've made simple grammar
I made a simple module for Lighttpd to experiment with it. If I just

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.