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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:14:02+00:00 2026-06-10T05:14:02+00:00

This might be a problem that I might overlook again but if you could

  • 0

This might be a problem that I might overlook again but if you could help me solve it, I will be very thankful.
Using this code to get images from drawable and sending it to Imageview.setImageResource (in which my Imageview is inside a gridview); everything works well

private   Integer[] imageIDs = {
            //R.drawable.image1,
            R.drawable.image2,
            R.drawable.image3,
            R.drawable.image4,
            R.drawable.image5,
            R.drawable.image6,
            R.drawable.Image7,
};

//Here is my another code to call imageIDs as ImageResource
ImageView iv = (ImageView)v.findViewById(R.id.grid_item_picture);
iv.setImageResource(imageIDs[position]);
//position is a default value of gridview starting from 0 

Now what I trying to accomplish is to delete that array and convert it to ArrayList simply because need these inside data to be dynamic. And so I’ve created this new code

ArrayList<String> array_image = new ArrayList<String>();
        array_image.add("R.drawable.image6");
        array_image.add("R.drawable.image1");

and set the ImageView ImageResource to this code

iv.setImageResource(array_image .get(position));

I am getting an error saying:

The method setImageResource(int) in the type ImageView is not applicable for the arguments (Object)
Can you help me fix/figure it out?

  • 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-10T05:14:04+00:00Added an answer on June 10, 2026 at 5:14 am

    You are defining an ArrayList for Strings. However you need integers as resource identifiers.

    Do it instead like this;

    ArrayList<Integer> array_image = new ArrayList<Integer>();
    array_image.add(R.drawable.image6);
    array_image.add(R.drawable.image1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize that without code this might be hard to answer but the problem
You will suppose this is a big question.but there might be a simple problem
This might be a simple problem that I have been over thinking, but I
I think this might be a problem with the theme I'm using ( Nitobe
I think my code might be written incorrectly and this is causing my problem.
I'm very confused and am hoping someone might have had this problem and be
This might seem like a very easy question for some of you folks, but
This might be rediculous, asking about such a huge bit of code...but basically I
I believe this might be one of the most common problem that users faces
I know the title of this question might be strange, but that was 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.