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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:02:23+00:00 2026-05-26T00:02:23+00:00

@@ Branislav-I did same as you have said.and it worked for me but when

  • 0

@@ Branislav-I did same as you have said.and it worked for me but when no of images exceeded to 9 n text also it started showing me same 1st or ant random image and text at the place of 9th image and text

public class ImageAdapter extends BaseAdapter {
private Context mContext;

public ImageAdapter(Context c) {
    mContext = c;
}

public int getCount() {
    return mThumbIds.length;
}

public Object getItem(int position) {
    return null;
}

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

// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
    View v;
    if (convertView == null) {  // if it's not recycled, initialize some attributes
        LayoutInflater li = getLayoutInflater();
        v = li.inflate(R.layout.mainmenu, null);
        TextView tv = (TextView)v.findViewById(R.id.icon_text);
        tv.setText(mTextsIds[position]);
        ImageView iv = (ImageView)v.findViewById(R.id.icon_image);
        iv.setImageResource(mThumbIds[position]);
    } else {
        v = (View) convertView;
    }
    return v;
}



  private Integer[] mThumbIds = {
        R.drawable.hotel1, R.drawable.rest,R.drawable.dubaicityinfoicon_new,R.drawable.history1,R.drawable.geography,R.drawable.infoicon,R.drawable.infoicon,R.drawable.infoicon,R.drawable.parkmain,

};

// references to our texts
private String[] mTextsIds = {
        "Hotels","Restaurants","City Info","Dubai History","Geography Of Dubai","Useful Information","Embassies in Duabai","Museum's","park"
};

In this it’s going perfect till museum but for park it’s not working; it is showing any random image and associated text within the array mThumbIds. And yes, the image is available in drawable.

  • 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-26T00:02:24+00:00Added an answer on May 26, 2026 at 12:02 am

    You can make custome adapter class for that

    public class MyAdapter extends ArrayAdapter<BindData> {
        private LayoutInflater inflater;
        private int layoutId;
    
        public MyAdapter(Context context, int layoutId, BindData[] objects) {
            super(context, 0, objects);
            this.inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            this.layoutId = layoutId;
        }
    
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder;
    
            if (convertView == null) {
                convertView = inflater.inflate(layoutId, parent, false);
                holder = new ViewHolder();
                holder.textView = (TextView) convertView.findViewById(R.id.textview);
                holder.imageView = (ImageView) convertView.findViewById(R.id.imageview);
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }
            //BindData data = getItem(position);
            holder.textView.setText(titles[position]);
            holder.imageView.setImageBitmap(imgs[position]);
            return convertView;
        }
    }
    

    and call that this way

    issueGridView = (GridView) findViewById(R.id.gvissue);  
            adapter =new MyAdapter(Issue.this, R.layout.issue_item, mDatas);
            issueGridView.setAdapter(adapter);
    

    Where mDatas is

    public class BindData {
        Bitmap b;
        String title;
        BindData(Bitmap bitmap, String s) {
            this.b = bitmap;
            this.title = s;
        }
    }
    private BindData[] mDatas;
        static class ViewHolder {
            TextView textView;
            ImageView imageView;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a list listcdtitles = [ Liszt, Hungarian Rhapsody #6 {'Pesther Carneval'}; 2
Edit I believe this is a issue with I am using windows 7 and
OK, I'm at my wits end. This seems like it should be a completely
Does anyone know of a compiled list of translations for the time zone names

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.