anyone knows how to specify array size?
public String[] videoNames = {""}
the array above can accomodate only one value. i want to extend how many values this array can accomodate.
You should write it like this.
String[] videoNames = new String[5]; // create videoNames array with length = 5
for(int i=0;i<videoNames.length();i++)
{
// IMPORTANT : for each videoName, instantiate as new String.
videoNames[i] = new String("");
}
if you want dynamic size then use arraylist. something like:
public ArrayList<String> myList = new ArrayList<String>();
...
myList.add("blah");
...
for(int i = 0, l = myList.size(); i < l; i++) {
// do stuff with array items
Log.d("myapp", "item: " + myList.get(i));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With