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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:02:57+00:00 2026-05-29T19:02:57+00:00

I have a listView, a main xml file and a customListview xml file. for

  • 0

I have a listView, a main xml file and a customListview xml file.
for my listView I am using a custom ArrayAdapter which I made.

Now, i would like to set an image as a resource in my MainActivity class.
the problem is that the image is in another xml, not in this which i set the contentView.

I am trying this code but nothing happens:

LayoutInflater mInflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View view=mInflater.inflate(R.layout.custom_row_view,null);
ImageView statusOk=(ImageView)view.findViewById(R.id.statusOkImage);
statusOk.setImageResource(R.drawable.ic_launcher);

If interested in all the code, youcan see here:
ImageView setVisibility(0) and null pointer exception

  • 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-29T19:03:00+00:00Added an answer on May 29, 2026 at 7:03 pm

    Change your get method in base adapter:

     public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.custom_row_view, null);
             holder = new ViewHolder();
             holder.txtName = (TextView) convertView.findViewById(R.id.name);
             holder.txtCityState = (TextView) convertView.findViewById(R.id.cityState);
             holder.txtPhone = (TextView) convertView.findViewById(R.id.phone);
    
             holder.statusOk=(ImageView)convertView.findViewById(R.id.imageView1);
    
             convertView.setTag(holder);
          } else {
             holder = (ViewHolder) convertView.getTag();
          }
    
    
    
    
           statusOk.setVisibility(View.VISIBLE);
           holder.txtName.setText(searchArrayList.get(position).getName());
           holder.txtCityState.setText(searchArrayList.get(position).getCityState());
           holder.txtPhone.setText(searchArrayList.get(position).getPhone());
    
           return convertView;
      }
    
    static class ViewHolder {
        TextView txtName;
        TextView txtCityState;
        TextView txtPhone;
    
        ImageView statusOk;
    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom listView. The main layout xml is something like this: <?xml
I have 2 xml files, a main file where I have a listView and
I have an app using a ListView as a main screen. Each row displays
I have created a custom tab layout which look like this,I want to make
I have a custom listview which changes size when one of the rows is
I have created a custom titlebar for all my listview activities using the following
The main concept goes like this. I have four listviews with its own data
I have a ListView which sometimes I need to put around 10000 items in.
I have a ListView containing file names. These file names need to be draggable
I am trying to do a listview which looks like this: (source: pici.se )

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.