Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 902577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:44:22+00:00 2026-05-15T15:44:22+00:00

My goal is to have multiple mp4’s stores in different folders on a server.

  • 0

My goal is to have multiple mp4’s stores in different folders on a server. I want to grab one of the videos from the folder when a certain condition is met. How would I grab a random video file from a particular folder? Here is the code I have written:

public static Uri getVideoPath(String cond){
  Uri tempPath;

  if((cond.equals("01"))||(cond.equals("02"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/sunny/");
  }else if((cond.equals("03"))||(cond.equals("04"))|| (cond.equals("05"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/some_sun/");
  }else if((cond.equals("06"))||(cond.equals("07"))||(cond.equals("08"))||
    (cond.equals("36"))||(cond.equals("37"))||(cond.equals("38"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/cloudy/");
  }else if((cond.equals("09"))||(cond.equals("10"))||(cond.equals("27"))||(cond.equals("28"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/light_gray/");
  }else if(cond.equals("11")){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/fog/");
  }else if((cond.equals("12"))||(cond.equals("13"))|| (cond.equals("14"))||
    (cond.equals("39"))||(cond.equals("40"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/showers/");
  }else if((cond.equals("15"))||(cond.equals("16"))|| (cond.equals("17"))||
    (cond.equals("40"))||(cond.equals("41"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/thunderstorms/");
  }else if(cond.equals("18")){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/rain/");
  }else if((cond.equals("19"))||(cond.equals("20"))|| (cond.equals("21"))||(cond.equals("43"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/flurries/");
  }else if((cond.equals("22"))||(cond.equals("23"))||(cond.equals("44"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/snow/");
  }else if((cond.equals("24"))||(cond.equals("25"))|| (cond.equals("26"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/ice/");
  }else if(cond.equals("29")){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/rain_and_snow/");
  }else if(cond.equals("30")){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/hot/");
  }else if(cond.equals("31")){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/cold/");
  }else if(cond.equals("32")){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/windy/");
  }else if((cond.equals("33"))||(cond.equals("34"))||(cond.equals("35"))){
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/clear/");
  }else{
   tempPath = Uri.parse("http://www.personal.psu.edu/tmv105/video/clear/");
  }   
  return tempPath;
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:44:23+00:00Added an answer on May 15, 2026 at 3:44 pm

    You could do something like this:

    File dir = new File(getVideoPath(condition));
    Random gen = new Random();
    
    File[] videos = dir.listFiles();
    
    int random_index = gen.nextInt(videos.length);
    
    return videos[random_index];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to have an AsyncTask that can execute multiple times (one task
I want to have multiple threads, each using a different proxy for Jakarta Common's
I have a project here the goal is to merge multiple Access DB's into
I have a maven pom.xml file with multiple instances of a same goal defined
goal: I have the string 1234432144 I want to only replace the first 2
I have multiple sets of xy pairs that I want to plot. I want
In less words: I have multiple JavaScript sections located at different places in document.
Goal : I have a view which displays multiple nodes in full view including
I'm using core data on an iPhone application. I have multiple persisntent stores that
Let me first describe my goal: I have created an object with 3 properties:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.