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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:56:47+00:00 2026-05-30T13:56:47+00:00

My problem might seems easy, but I really can’t resolve it. At some point,

  • 0

My problem might seems easy, but I really can’t resolve it. At some point, my code displays a bunch of images (ImageView) in a LinearLayout, inside an AlertDialog.
The problem is that not everything is displayed.

Here’s my code :

public  LinearLayout createLayout(String text) {
    LinearLayout ll = new LinearLayout(this.c);

    int res;
    for(int i=0; i<text.length(); ++i) {
        res = this.c.getResources().getIdentifier("pigpen_" + Character.toLowerCase(text.charAt(i)), "drawable", this.c.getPackageName());
        ImageView iv = new ImageView(this.c);
        iv.setPadding(5, 0, 0, 5);
        iv.setImageResource(res);
        ll.addView(iv);
    }
    return ll;
}

And the code for the DialogAlert :

protected ResultDialog(final Context context, CharSequence title, LinearLayout ll) {
    super(context);

    ll.setPadding(10, 5, 10, 5);

    this.setView(ll);
    this.setTitle(title);
}

image

And as you can see, the result is not good. Do you have any idea why?

  • 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-30T13:56:48+00:00Added an answer on May 30, 2026 at 1:56 pm
        LinearLayout ll = new LinearLayout(this.c); 
        ArrayList<Integer> alImages = new ArrayList<Integer>();
        ll.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    
        for(int i=0; i<text.length(); ++i) {
            cur = text.charAt(i);
            pos = this.getCharAlphabetPosition(cur);
            if(pos > 0 && pos < alphabetId.length) {
                res = alphabetId[pos];
                alImages.add(res);
            }
        }
        gv.setAdapter(new ImageAdapter(this.c, alImages));
        gv.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    
        gv.setNumColumns(GridView.AUTO_FIT);
        gv.setColumnWidth(25);
    
        ll.addView(gv);
    }
    

    Et ma classe ImageAdapter :
    public class ImageAdapter extends BaseAdapter implements ListAdapter {
    private Context c;
    private ArrayList alImages;

    public ImageAdapter(Context c, ArrayList<Integer> alImages) {
        this.c = c;
        this.alImages = alImages;
    }
    
    public int getCount() {
        return this.alImages.size();
    }
    
    public Integer getItem(int position) {
        return this.alImages.get(position);
    }
    
    public long getItemId(int position) {
        return 0;
    }
    
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(this.c);
            imageView.setLayoutParams(new GridView.LayoutParams(25, 25));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(5, 0, 0, 5);
        } else {
            imageView = (ImageView) convertView;
        }
    
        imageView.setImageResource(this.getItem(position));
        return imageView;
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It might sound unnecessary, but let me explain my problem first. Probably then it
Ok, this might be a really odd problem. I am writing a web application,
I'm thinking this should be easy, but I can't seem to figure this out.
I am working on this animation function but I have a problem. I can't
(I foresaw this problem might happen 3 months ago, and was told to be
Woo, I have a doozy of a problem (might even be one for the
This might be a problem with my understanding with Curses more than with Perl,
I think this might be a problem with the theme I'm using ( Nitobe
The tags might not be accurate since I am not sure where the problem
I think I might be having a stack overflow problem or something similar in

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.