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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:08:10+00:00 2026-06-04T23:08:10+00:00

Hey im trying to get a List working, in that case i have a

  • 0

Hey im trying to get a List working, in that case i have a xml defined item, which i inflate in a extended ArrayAdapter. But after i have inflated the xml, then when i try to grab the imageview, it returns null by findviewbyid…
Here is xml for the item:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
    <TextView 
        android:id="@+id/product_item_textview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="if no image avail show this"
        android:visibility="gone"/>
    <ImageView 
        android:id="@+id/product_item_imageview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:visibility="visible"
        />

</LinearLayout>

Method that instatiates the item:

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        SimpleListItem item= items.get(position);
        LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = vi.inflate(R.layout.product_item, null);
        if(item.getPicture()!=null)
        {
            ImageView imgVw = (ImageView) findViewById(R.id.product_item_imageview);
            String picturePath = item.getPicture();
            Bitmap picture = ImageManager.get(getBaseContext(), picturePath);
            imgVw.setImageBitmap(picture);
        } else {
            TextView txtVw = (TextView) findViewById(R.id.product_item_textview);
            txtVw.setText(item.getText());
            txtVw.setVisibility(View.VISIBLE);
        }
        return v;
    }
  • 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-04T23:08:12+00:00Added an answer on June 4, 2026 at 11:08 pm

    Its a,

      ImageView imgVw = (ImageView) v.findViewById(R.id.product_item_imageview);
    

    also the same for TextView,

     TextView txtVw = (TextView) v.findViewById(R.id.product_item_textview);
    

    Use View v for getting ImageView and TextView from your inflated xml file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, i have a problem with trying to get 2 forms to close
Hey, I was trying to delete an item form a list (without using set
Hey everyone, my problem is that im trying to figure out how to get
Hey, I'm trying to get an extension to wait for a xml message from
Hey, I'm trying to get this nav working nicely: http://www.moreheadplanetarium.org/redesign/nav.html I can't figure out
Hey trying to get a validation check working on a boolean field called 'activated'.
Hey i'm trying to get the side with which the two objects in the
Hey everyone I'm trying to get a clearer understanding of LINQ. I have a
Hey I'm trying to get this working but I am not a c# programmer.
Hey i'm trying to access a windows share to get a given XML file

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.