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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:38:30+00:00 2026-05-24T12:38:30+00:00

I’ve got a rather peculiar problem. I am trying to pass a number of

  • 0

I’ve got a rather peculiar problem. I am trying to pass a number of parameters to a method in a different class, and three out of the four parameters are being passed just fine. The fourth, however, is returning 0 (zero) regardless of what I seem to do.

I am initializing the second class, ImageLoader, without any issues.

Here’s the call in question – I’ve added comments to explain my problem:

imageLoader.DisplayImage(coverFileNames.get(position), Main.this, (ImageView) convertView, position); // coverFileNames.get(position) works great and returns the correct filename based on the position - position on its own, however, doesn't!

And here’s the DisplayImage method:

public int position;

public void DisplayImage(String fileUrl, Activity activity, ImageView imageView, final int pos) {
                position = pos; // this is 0 no matter what I do
                imageViews.put(imageView, fileUrl);
                queuePhoto(fileUrl, activity, imageView);
                imageView.setImageResource(R.drawable.noposterlarge);
            }

Any ideas? Thanks.

EDIT:

Here’s the GetView method:

public View getView(int position, View convertView, ViewGroup parent) {

            if (convertView == null) {
                convertView = (ImageView) new ImageView(Main.this);
            }

            // Create new file for the file path of the movie
            File file = new File(videoUrls.get(position));

            // Create variables for potential custom art check
            boolean potentialImage = false;
            String ImageFile = null;
            String[] potentialImageFiles = new String[]{file.getAbsolutePath().substring(0, file.getAbsolutePath().lastIndexOf(".")) + ".jpg",
                    file.getAbsolutePath().substring(0, file.getAbsolutePath().lastIndexOf(".")) + ".jpeg",
                    file.getAbsolutePath().substring(0, file.getAbsolutePath().lastIndexOf(".")) + ".JPG",
                    file.getAbsolutePath().substring(0, file.getAbsolutePath().lastIndexOf(".")) + ".JPEG"};

            // Check if each file exists and return if one does
            for (String potentialFile : potentialImageFiles) {
                if (!potentialImage) {
                    if (new File(potentialFile).exists()) {
                        potentialImage = true;
                        ImageFile = potentialFile;
                    }
                }
            }

            final BitmapFactory.Options options = new BitmapFactory.Options();
            options.inSampleSize = 2;
            options.inPreferredConfig = Config.RGB_565;

            // Check if there's a custom cover art
            if (potentialImage) {
                Log.d("TEST", "POS: " + position); // this returns the correct value
                imageLoader.DisplayImage(ImageFile, Main.this, (ImageView) convertView, position);
            } else {
                Log.d("TEST", "POS: " + position); // this returns the correct value
                imageLoader.DisplayImage(coverFileNames.get(position), Main.this, (ImageView) convertView, position);
            }

            return convertView;
        }

And again, here’s the DisplayImage method:

public void DisplayImage(String fileUrl, Activity activity, ImageView imageView, final int pos) {
            Log.v("Testing", "position = " + pos); // This returns 0, which is not correct
            imageViews.put(imageView, fileUrl);
            queuePhoto(fileUrl, activity, imageView);
            imageView.setImageResource(R.drawable.noposterlarge);
        }
  • 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-24T12:38:32+00:00Added an answer on May 24, 2026 at 12:38 pm

    this is simply impossible

    Add to top of DisplayImage

    Log.v("DisplayImage", "position = " + position);
    

    If it is 0

    Change the calling code from

    imageLoader.DisplayImage(coverFileNames.get(position), Main.this, (ImageView) convertView, position); 
    

    to

    imageLoader.DisplayImage(coverFileNames.get(position), Main.this, (ImageView) convertView, 2); 
    

    Now, will it show 2? It must


    It means that in your calling code in the line imageLoader.DisplayImage() position has always been 0 for some reason.

    coverFileNames.get(position) is always returning the String at position=0


    Try removing the final modifier from your DisplayImage function

    public void DisplayImage(String fileUrl, Activity activity, ImageView imageView, int pos)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.