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 6086267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:43:57+00:00 2026-05-23T11:43:57+00:00

I am trying to create a Spinner or similar drop down/selector in Android. Similar

  • 0

I am trying to create a Spinner or similar drop down/selector in Android. Similar to opening a file, I want the Spinner to list all of the files found in a specified directory path.

I.E. –> I have a directory with example1.txt, example2.txt, mymp3.mp3, otheraudio.3pg @ C://path/mystuff

I want the spinner to populate based on the files in the directory so you will have the option to pick any of the files in the directory.

The spinner is mainly a “display only” functionality. I just need it to get the file names of the files in the directory. There will be a button that will contain the functionality to open the selected file from the spinner.

Not sure how to go about setting this up… Would it be best to get all the file names through java, then store it in a string array in the XML for the spinner to read, or some other way?

  • 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-23T11:43:57+00:00Added an answer on May 23, 2026 at 11:43 am

    Assuming that you’re talking about a directory on your phone (your reference to C://path/mystuff has confused me as this isn’t a Linux path) I don’t see that there are any benefits to creating an XML file to list the files. Is this just so you can use ArrayAdapter.createFromResource(…)?

    You can just do something like the following:

    ....
    List<String> filenames = new ArrayList<String>();
    // populate above list from your desired path 
    
    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.simple_spinner_item, filenames);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm all new to Android and I'm trying to create a spinner programmatically and
I have created a drop down in my android application using a spinner. However
I am a newbie to android development. I am trying to create a List
Hie all , I am trying to create an simple application and i want
Trying to create a list to return some JSON data to a view. Following
(Android 3.0+) How would I create a Spinner for use as an Action Item
I'm trying to create a custom attribute called Tag for all editable elements. I
Greetings all, I'm trying to create a specific layout that should be very simple
Trying to create a simple spinner effect with Jquery, i.e. two buttons (up &
I'm trying to create a jQuery spinner type thing earlier today somebody gave me

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.