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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:28:20+00:00 2026-05-26T20:28:20+00:00

In My Application i have Implement the Simple Gallery Demo. Here i am going

  • 0

In My Application i have Implement the Simple Gallery Demo.
Here i am going to set text Value according to user viewing the gallery.

Here is my Code for GetView method of Image Adapter class:

public View getView(int position, View convertView, ViewGroup parent) {
        ImageView i = new ImageView(this.myContext);

        i.setImageResource(this.myImageIds[position]);

        /* Image should be scaled as width/height are set. */
        i.setScaleType(ImageView.ScaleType.FIT_XY);
        /* Set the Width/Height of the ImageView. */
        i.setLayoutParams(new Gallery.LayoutParams(300, 300));

        switch(position){

        case 0:
            productName.setText("dimond540_1");

            break;
        case 1:
            productName.setText("diamond540_2");

            break;
        case 2:
            productName.setText("diamond_ink_bottle_1");

            break;
        case 3:
            productName.setText("diamond_ink_bottle_2");

            break;
        case 4:
            productName.setText("diamond_ink_bottle_3");

            break;
        case 5:
            productName.setText("micarta_1");

            break;
        case 6:
            productName.setText("micarta_2");

            break;
        case 7:
            productName.setText("vac700_1");

            break;
        case 8:
            productName.setText("vac700_2");

            break;
        }
        return i;
    }
    /** Returns the size (0.0f to 1.0f) of the views
     * depending on the 'offset' to the center. */
    public float getScale(boolean focused, int offset) {
            /* Formula: 1 / (2 ^ offset) */
        return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset)));
    }
}

Now the Proble is, While i am viewing the gallery image, text value is change. But i am not able to get the textValue that i have set as second position and Second last position.

I have tryed many but every time i got all value but not the second position textValue and SecondLast position textValue.

So, whats wrong in my code?

  • 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-26T20:28:21+00:00Added an answer on May 26, 2026 at 8:28 pm

    I have solve My Question as below:

    I have made the Method in that class and in that method i change the TextValue and it works great.

    Code:

     public long getItemId(int position) { 
    
            switch(position){
    
            case 0:
                productName.setText("Dimond540(1)");
    
                break;
            case 1:
                productName.setText("Dimond540(2)");
    
                break;
            case 2:
                productName.setText("Diamond Ink Bottle(1)");
    
                break;
            case 3:
                productName.setText("Diamond Ink Bottle(2)");
    
                break;
            case 4:
                productName.setText("Diamond Ink Bottle(3)");
    
                break;
            case 5:
                productName.setText("Micarta(1)");
    
                break;
            case 6:
                productName.setText("Micarta(2)");
    
                break;
            case 7:
                productName.setText("Vac700(1)");
    
                break;
            case 8:
                productName.setText("Vac700(2)");
    
                break;
            }
    
            return position; 
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to have a C# application implement the Konami Code to display
I need to implement a simple logging mechanism for my web application. I have
I have simple application, that shows list of many items, where user can display
I have a Django application in which I need to implement a simple trending/ranking
In our desktop application, we have implemented a simple search engine using an inverted
Very simple Qt GUI application: On the scene I have multiple circles implemented as
I have to implement the VinPower application. They offer a Java version, a C
I have a school project in which I have to implement a chat application,
We are trying to implement a REST API for an application we have now.
I am creating an application. I have to implement a bookmark feature, and adding

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.