Answer by jjjd helped me to set text of multiple objects but now I have a problem many events at a date 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 {name of public end string; Public last string title; Public final string description; Public event (last string a_name, last string a_title, last string a_details) {name = a_name; Title = a_title; Description = a_details; }}; Last event e = eventDetails (1, 4); Name.setText (e.name); Title.setText (e.title); Details.setText (e.details); // Event Description Public event event description (int m, int d) {switch (m) {case 1: if (d == 10) {new event ("event1", "my-title1", "mydetails1"); } If (d == 28) {New Event Back ("Event2", "Mine-Title1", "mydetails1"); Return new events ("Event 3", "MyTit2", "Mindest 2"); // 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"); }
To store events given by eventDetails, you will do something like this:
Arreelist & lt; Event & gt; E = new arrelisted & lt; Event & gt; (); E.add (eventDetails (1, 4)); // It adds an event to the AreList , then to access the events stored in the array, E:
Event A = E.A.G .t. (0); // First events in Array List event two = E. Gate (1); // Second event in the array list ... event n = e.gate (n); // nth event in the array list If you want to make it dynamic rather than explicitly say, then e.get (0) The shape of the loop above will be as ArrayList as follows: for (int i = 0; i & lt; e.size (); i ++) {event ev = e. Get (i); Ev.doSomething (); Ev.doSomethingElse (); }
Comments
Post a Comment