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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:26:06+00:00 2026-06-07T16:26:06+00:00

The answer here by @hmjd helped me to set the text of multiple objects.

  • 0

The answer here by @hmjd helped me to set the text of multiple objects. But I have run into a problem now. A date can have multiple events and I would like to show all the events and their details on the same event details page. How can I do this?

Code:

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;
    }
};



final Event e = eventDetails(1, 4);
name.setText(e.name);
title.setText(e.title);
details.setText(e.details);

//event details
public Event eventDetails(int m, int d) {
    switch (m) {
        case 1:
            if (d == 10) {
                return new Event("event1", "my-title1", "mydetails1");
            }
            if (d == 28) {
                 return new Event("event2", "my-title1", "mydetails1");
                 return new Event("event3", "my-title2", "mydetails2"); //add another event on this date; obviously this is not the right way.
            }

            break;

    }

    return new Event("default_my-name2", "default_my-title2", "default_mydetails2");
}
  • 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-07T16:26:07+00:00Added an answer on June 7, 2026 at 4:26 pm

    To store the events returned by eventDetails, you would do something like this:

    ArrayList<Event> e = new ArrayList<Event>();
    e.add(eventDetails(1, 4)); // This adds one event to the ArrayList
    

    Then to access the Events stored in ArrayList e:

    Event one = e.get(0); // First Event in the ArrayList
    Event two = e.get(1); // Second Event in the ArrayList
    ...
    Event n = e.get(n); // nth Event in the ArrayList
    

    If you want to make this dynamic instead of explicitly saying e.get(0), you would loop over the size of the ArrayList as follows:

    for (int i = 0; i < e.size(); i++)
    {
        Event ev = e.get(i);
        ev.doSomething();
        ev.doSomethingElse();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After getting a helpful answer here , I have run into yet another problem:
I recently posted my problem but neither did I get an answer here or
Have looked for an answer here, but couldn't find one. When you call: myTableAdapter.Update(myDataTable);
Hoping there's a simple answer here but I can't find it anywhere. I have
I see the answer here is no, but wondered if there is any update
I am not looking for the answer here but just how to find the
How would you do a similar function as rsplak's answer here https://stackoverflow.com/a/7079032/1330629 but include
I'm sure there's an easy answer here and i'm just over-complicating things, but i
I have this question after reading the answer here , what's the difference at
Edit: found the answer here: Using Ember.js, how do I run some JS after

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.