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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:35:26+00:00 2026-06-16T15:35:26+00:00

I have multiple strings like st1, st2, st3, st4, st5, st6, st7. now i

  • 0

I have multiple strings like st1, st2, st3, st4, st5, st6, st7. now i want to get that strings dynamically through for loop using its counter(in my case int i). like “st”+ i , but the android doesnot accept it so what should i do to get the string dynamically. for more info here is the chunk of the code

String image1 = cData.getString(cData.getColumnIndex("fld_image_url1"));
String image2 = cData.getString(cData.getColumnIndex("fld_image_url2"));
String image3 = cData.getString(cData.getColumnIndex("fld_image_url3"));
String image4 = cData.getString(cData.getColumnIndex("fld_image_url4"));
ArrayList<String> imagesArray = new ArrayList<String>();

 //for adding the string in the arraylist dynamically
for(int i=1;i<=4;i++){
    if("image"+i!=null){
        imagesArray.add(String.valueOf("image"+ i));    
    }
}
  • 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-16T15:35:27+00:00Added an answer on June 16, 2026 at 3:35 pm

    How about something like:

    List<String> imagesArray = new ArrayList<String>();
    for (int i = 1; i <= 4; i++) {
        String image = cData.getString(cData.getColumnIndex("fld_image_url" + i));
        if (image != null) {
            imagesArray.add(image);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have XAML like this.. Basically it concatenates multiple strings that bind to different
I have multiple lists of strings, IList<string> , that I want to consolidate in
i have multiple strings containing a link like: <A HREF=http://www.testings2>testings2</A> <A HREF=http://www.blabla>blabla</A> <A HREF=http://www.gowick>gowick</A>
I have a long string of comments that I'd like to split into multiple
I have multiple web services that write data inside a database table. I'd like
I do have some strings that contains programming code, like XHTML (asp.net markup), C#,
I'm receiving multiple strings from a API and sometimes I have a string that
Assume that i have two strings like the following. $sa = 12,20,45; $sb =
I have strings like this: "This______is_a____string." (The "_" symbolizes spaces.) I want to turn
I have multiple strings that are all number values. They are all inside the

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.