android - Dynamically name objects in Java -


i'm working on android project , have problem creating objects dynamically.

for example, want events named this:

*event1

*event2

...

i'm used work in php, , know can't same way in java because code has compiled before program starts.

i don't know how many objects program have make, data comes online database. i'm able create 1 event if put this:

event event = new event(); 

i make object each event , store each object in db4o database.

as said, it's possible there 1 event, possible there 100 events.

it sounds need collection of events. try putting them in simple data structure arraylist (similar array, can expand in size @ run time). way won't have multiple variables event1, event2, etc., 1 variable named events (or similar) holds many objects need.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -