in java, arrays are fixed size. if you want a growable list of object, use ArrayList or explore java.util for other alternatives.

String[] sa = new String[2];
s[0] = "hello";
s[1] = "world";

List<String> sl = new ArrayList<String>();
sl.add("hello");
sl.add("wold");
...

I'm new to Android and Java and am stumped on the simplest things.

How do I create a simple array and push/clear it?

I'm used to something like
myarray = new Array()  // creates empty array
myarray.push("something")  // array now has one element at index [0]
myarray.push("something_else")  // array now has two elements
myarray = new Array() // overwrites and therefore resets array

I can't find the equivalent in android.  Can someone please enlighten
me.
You'd be amazed at how much time I've spent searching before posting.
Seriously amazed...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

  

--

Reply via email to