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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:12:04+00:00 2026-05-29T19:12:04+00:00

I am making an android app that shows the Calendar day view, it looks

  • 0

I am making an android app that shows the Calendar day view, it looks like a list with colored blocks floating on top of it which represent event start time and end time.

I was able to do everything correctly, however I wanted to sort events based on the same times or overlapping times or events which have start time or end time within the range of other event’s start time and end time.

Start time and end time are in Milliseconds.

I store start times in startTimeList and end times in endTimeList and iterate through the list to compare the times.

For the purpose of this I wrote this method which compares if the time is within the range of another event’s start or end

public boolean isInRange(long timeToBeCompared,long startTime,long endTime){
  if(timeToBeCompared>=startTime&&timeToBeCompared<=endTime){
    return true;
    }
    return false;
  }

I put in first event’s starttime or endtime through the above method and pass in second event’s start and end time as second and third parameters and I check if its true and use a variable count to hold the count of similar start and end times. However my count value is wrong.

Is there any other good approach?

  • 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-05-29T19:12:06+00:00Added an answer on May 29, 2026 at 7:12 pm

    Try out this code:

    /** Checks whether two intervals overlap. */
    boolean overlap(long startTime1, long endTime1, long startTime2, long endTime2) {
        if (endTime1 < startTime2 || startTime1 > endTime2) {
            return false;
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm making an android app that has more than 100 buttons,but you know
I'm making a Android app that basically plays video from a website on the
I am making an android app that uses a webview to visit a website.
I'm making a hand-outs app for android or like a book reader for android.
I'm making an Android app that tracks a user and displays their location in
I'm making a new Android app that essentially mirrors data available on our website.
Ive made edits since the orignal post Im making an android app that connects
So I'm making an Android 2.2 app that uses GLSurfaceView. My question is, since
I'm making an android 1.6 app that uses phone's camera. In order to do
I'm working on making an iPhone version of an Android app that I've written

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.