Categories
Random object selection on Andorid?
Hello! Can someone help write code so that when a button is clicked, an object from the directory is randomly selected. android.
Answer the question
In order to leave comments, you need to log in
file or class (class object) ? O_O
Random r=new Random(); File path=new File("/dir"); File[] fileList=path.listFiles(); int index=(r.nextInt(fileList.length));
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question