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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:32:27+00:00 2026-06-07T05:32:27+00:00

I have a calendar in which if the user selects the date and it

  • 0

I have a calendar in which if the user selects the date and it takes him to an event details page. On the event details page the data is displayed in a tabular format. So far so good. The problem is how to set the details of the event in the eventDetails function and return them to set the text.

Code:

  //get the data and split it
    String[] dateAr = date_string.split("-|\\||\\(|\\)|\\s+");
    m = Integer.parseInt(dateAr[6]);
    d = Integer.parseInt(dateAr[3]);
    y = Integer.parseInt(dateAr[8]);

    name = (TextView) this.findViewById(R.id.name);
    title = (TextView) this.findViewById(R.id.title);
    details = (TextView) this.findViewById(R.id.details);


    name.setText(name_details); //should get the info from the eventDetails method
    title.setText(title_details); //should get the info from the eventDetails method
    details.setText(event_details); //should get the info from the eventDetails method

  //event details
  public String eventDetails(int m, int d) {
    String holiday = "";
    switch (m) {
        case 1:
            if (d == 1) {
                holiday = "Some event";
            } else if (d == 10) {
                holiday = "Some event";
            }
            break;
        case 3:
            if ((d == 11) || (d == 12)) {
                holiday = "Some event";
            }
            break;
        case 7:
            if ((d == 1) && (d== 7)) {
                holiday = "Some event";
            }
            break;
    }

    return holiday;
}

The String holiday returns only one object. I want to get the name, title and details and set the corresponding element’s text to it. How can I achieve this? How do I add the name, title and details as separate objects and return them as separate objects to set the text accordingly? DO I add them to an array? Something like for every event date:

String holiday[] = {"name of the event", "title of the event", "details of the event"};

If so, how do I return the array to set the text?

  • 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-07T05:32:29+00:00Added an answer on June 7, 2026 at 5:32 am

    Create a class that contains these event details and return an instance of it. For example:

    public class Event
    {
        public final String name;
        public final String title;
        public final String details;
    
        public Event(final String a_name,
                     final String a_title,
                     final String a_details)
        {
            name = a_name;
            title = a_title;
            details = a_details;
        }
    };
    
    public Event eventDetails(int m, int d) {
        if (some-condition)
            return new Event("my-name1", "my-title1", "mydetails1");
        else
            return new Event("my-name2", "my-title2", "mydetails2");
    }
    
    final Event e = eventDetails(1, 4);
    name.setText(e.name);
    title.setText(e.title);
    details.setText(e.details);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have calendar in Qt. I want when user selects date, 14(Qint32) will be
i have a textbox which is filled with date from a datepicker(calendar is accessed
I have the following jQuery code: $(body.page-calendar-practices-2012-05 #content-header h1#title) which works fine. I can
I have a XML-file, which contains the data of a calendar. I want to
I am developing an application which requires to add Calendar event. I have written
I have a javascript restricted calendar on a textbox, which prevents the user from
I have an edit script which retrieves calendar events and lets the user edit
I have one Calendar object which is as per the user's time zone which
I have a view controller which contains a field for user to enter date
I have created one user control to pick date from calendar. I used jquery

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.