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

  • Home
  • SEARCH
  • 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 8556725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:25:08+00:00 2026-06-11T15:25:08+00:00

I have many text files and want to put them in a for loop.

  • 0

I have many text files and want to put them in a for loop.

I get an Extra that have Resource name from last activity (s)
and have an array that have Resource name of
my text files in raw Resource is from {d0,d1,d2,d3, …,d79}
and I want to check name(s) and array name and put the find name to resource!
I have error on (res=R.raw.(d[i]))
my code :

    int res = 0;
    for (int i = 0; i <=79; i = i + 1) {
        if (s.equals(d[i])){
            res=R.raw.(d[i])
        }
    } 
    inputstream = getResources().openRawResource(res);
  • 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-06-11T15:25:10+00:00Added an answer on June 11, 2026 at 3:25 pm

    You can use getIdentifier (String name, String defType, String defPackage) for fetching resource id dynamically,

    ArrayList<Integer> id = new ArrayList<Integer>();
    for (int i = 0; i <= 79; i++) {
      id.add(getResources().getIdentifier("d"+i, "raw", getPackageName()));
    }
    

    Now you will have all the resources id’s inside id ArrayList

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Like many, I have spreadsheet that draws data from over 40 text files as
I have many text files containing bank transactions in the middle of them. Each
I read many files from my system. I want to read them faster, maybe
I am having many text files scattered across many subdirectories. Just want to have
I have a folder with 100k text files. I want to put files with
I have many text files, their total size is about 300GB ~ 400GB. They
I have a few text files and I'd like to count how many times
I have a directory of text-based, compressed log files, each containing many records. In
Kind of like this question I have many text snippets that I use many,
I want to translate text in Indian languages. I have gone through many articles

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.