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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:26:25+00:00 2026-06-02T19:26:25+00:00

I can display my images inside gallery through gallery adapter. Now, I need to

  • 0

I can display my images inside gallery through gallery adapter. Now, I need to add Title to each image at the bottom of that. I have no idea how to add it. This is my adapter code:

    public class LensaPhotoAdapter_KM extends BaseAdapter{

    private int mGalleryItemBackground;

    private Context context;

    private ImageLoader imageLoader;
//  private File cacheDir;
    private ImageLoaderConfiguration config;
    private DisplayImageOptions options;
    private ArrayList<String> imageURLs = new ArrayList<String>();
    private ArrayList<String> imageTitle = new ArrayList<String>();


    public LensaPhotoAdapter_KM(Context context){
        Log.i("LensaPhotoAdapter", "Try to build the screen...");

        this.context = context;

        TypedArray attr = context.obtainStyledAttributes(R.styleable.HelloGallery);
        mGalleryItemBackground = attr.getResourceId(R.styleable.HelloGallery_android_galleryItemBackground, 0);
        attr.recycle();

        // Get singleton instance of ImageLoader
        imageLoader = ImageLoader.getInstance();
    }



    public void setData(ImageFeedItemList imageFeedItemList){
        int numberOfItems = imageFeedItemList.getHeaderImage().size();

        imageTitle = imageFeedItemList.getTitle();

//      for(String str: imageFeedItemList.getHeaderImage())
//          Log.i("title is:", str);

        for(int i=0; i<numberOfItems; i++){
            String str = imageFeedItemList.getTitle().get(i);
            str = str.substring(0, str.indexOf(" "));
            if(str.equalsIgnoreCase("Konsert"))
                imageURLs.add(imageFeedItemList.getHeaderImage().get(i));

//          for(String str1: imageURLs)
//              Log.i("title is:", str1);
        }

//      cacheDir = new File(Environment.getExternalStorageDirectory(), "UniversalImageLoader/Cache");

        // Create configuration for ImageLoader
        config = new ImageLoaderConfiguration.Builder(context)
                    .maxImageWidthForMemoryCache(800)
                    .maxImageHeightForMemoryCache(800)
                    .httpConnectTimeout(5000)
                    .httpReadTimeout(30000)
                    .threadPoolSize(5)
                    .threadPriority(Thread.MIN_PRIORITY + 2)
                    .denyCacheImageMultipleSizesInMemory()
                    .memoryCache(new UsingFreqLimitedMemoryCache(2000000)) // You can pass your own memory cache implementation
//                  .discCache(new UnlimitedDiscCache(cacheDir)) // You can pass your own disc cache implementation
                    .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
                    .build();

        // Creates display image options for custom display task
        options = new DisplayImageOptions.Builder()
                    .showStubImage(R.drawable.icon_loading)
                    .showImageForEmptyUrl(R.drawable.icon_remove)
                    .cacheInMemory()
                    .cacheOnDisc()
                    .decodingType(DecodingType.MEMORY_SAVING)
                    .build();

        // Initialize ImageLoader with created configuration. Do it once.
        imageLoader.init(config);
    }



    //---returns the number of images---
    public int getCount() {
        return imageURLs.size();
    }

    //---returns the ID of an item--- 
    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return position;
    }

    //---returns an ImageView view---
    public View getView(int position, View convertView, ViewGroup parent){      
        ImageView imageView = new ImageView(context);
        imageView.setLayoutParams(new Gallery.LayoutParams(250, 250));
        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        imageView.setBackgroundResource(mGalleryItemBackground);

        // Load and display image
        String imageUrl = imageURLs.get(position);
        imageLoader.displayImage(imageUrl, imageView, options);

        return imageView;
    } 
} 

Any suggestion would be appreciated. Thanks

  • 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-02T19:26:25+00:00Added an answer on June 2, 2026 at 7:26 pm

    In your getView(), instead of creating the ImageView on the fly, you can inflate a layout that has both an ImageView and a TextView, which you can then fill in appropriately:

        View container = inflater.inflate(R.layout.the_layout, parent, false);
        ImageView image = ll.findViewById(R.id.image);
        String imageUrl = imageURLs.get(position);
        imageLoader.displayImage(imageUrl, imageView, options);
        TextView text = ll.findViewById(R.id.text);
        text.setText("whatever");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display images in a TableView . I can display one image
I am trying to produce images without gamma information so that IE8 can display
Examotion has a player that can display the image for svg files as a
How can i display a list of images stored in an array as list
How can I set all images in one line and display only the first
So, I want to display titles and excerpt in line with images? How can
i can't display the image on my aspx view.. i'm using mysql as database
How can I display jpg image which I stored in arraylist in JPanel? Im
how can i display a image on button which is presented on UINavigationController iphone
I want to display images inside single select when it appears inside dialog. alt

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.