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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:57:32+00:00 2026-06-11T08:57:32+00:00

Good day, Hope title is not confusing and i can be clear here. I

  • 0

Good day, Hope title is not confusing and i can be clear here. I have a custom ArrayAdapter with TextViews and ImageViews. now i want one of the TextView to be populated by values from a HashMap which have the 2nd columns as the Keys. the structure is just like this..

image1 shop text2

image2 cars text2

image3 House text2

image4 boats text2

In this example, the 1st and 2nd columns have already been populated with arrays in the ArrayAdapter. so i want the text2, to be populated with a HashMap of values of which column2 are the keys. an example is, if there are 30 shops, we will have

image1 shop 30

code is :

    Resources rsc = getActivity().getResources();
        String[] options = rsc.getStringArray(R.array.item_title);
        TypedArray icons = rsc.obtainTypedArray(R.array.item_title_color);
  HashMap<String,String> map = new HashMap<String,String>();

    MyAdapter adapter = new MyAdapter(getActivity(), R.layout.listview_custom_item, options, icons, map);
        list.setAdapter(adapter);

MyAdapter class:

class MyAccountsAdapter extends ArrayAdapter<Object> {
        private LayoutInflater mInflater;
        private int ViewResourceId; 
        private String[] mstring;
        TypedArray icons;
        HashMap<String, String> infomap = new HashMap<String,String>();

    public MyAdapter(Context context, int textViewResourceId, String[] string, TypedArray icons, HashMap<String, String> map) {
            super(context, textViewResourceId, string);

      mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              mstring = string;
              this.icons = icons;
              ViewResourceId = textViewResourceId;
              infomap.putAll(map);  //another hashmap here
        }

    @Override
        public int getCount(){
            return mstring.length;
        }

            @Override
        public View getView(int position, View convertView, ViewGroup parent){
            convertView = mInflater.inflate(ViewResourceId, null);

            ImageView imageview = (ImageView)convertView.findViewById(R.id.list_image_id);
            TextView text_title = (TextView)convertView.findViewById(R.id.list_text_id);
            TextView text_info = (TextView)convertView.findViewById(R.id.list_textinfo_id);

            imageview.setImageDrawable(icons.getDrawable(position));
            text_title.setText(mstring[position]);
            Log.d(TAG, "strings are" + text_title.getText().toString());

// so how do i populate text_info here to correspond with text_title;

            return convertView;
        }

any ideas? or is there a better way to do this like combine them all into one?.. any help is highly appreciated. Thank you

  • 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-11T08:57:34+00:00Added an answer on June 11, 2026 at 8:57 am

    Try this below code :

       text_info.setText(infomap.get(mstring[position]));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day I have a custom TextBox that has a IndicatorTextBox.ui.xml file as well
Good day, I have a simple question (I hope). How do I access the
Good day, Hope the tilte is not misleading. please take a look at the
hope you're having a good day. I have been programming a IRC chatbot in
Good day everyone, so here, I have a problem with my repeater control's SQL
Good day, I have like 2 question here: First a background information. from the
I am not very good with this, so I hope somebody can help me.
Good day! I just want to ask if an InfoBubble can have a listener.
Good Day, Can someone confirm what was said at the bottom of this post
Good day, I have a class that implements the LoaderCallbacks, and hence have the

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.