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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:43:15+00:00 2026-05-15T18:43:15+00:00

Doing some R&D for my company. We are trying to have a listView that

  • 0

Doing some R&D for my company. We are trying to have a listView that contains an imageview, and two edit boxes for each entry in the listview.

<?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="horizontal"
  android:isScrollContainer="true"
  android:focusableInTouchMode="false"
  android:focusable="false">
  <ImageView android:id="@+id/imgView"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:maxWidth="100dp"
  android:maxHeight="100dp"/>
  <LinearLayout 
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="vertical">
    <EditText android:id="@+id/img_title"
    android:hint="Title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:minWidth="150dp"/>
    <EditText android:id="@+id/img_desc"
    android:hint="Description"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:minWidth="150dp"/>
  </LinearLayout>
</LinearLayout>

This is the layout file I am attempting to use for the item that will be within the listview. Within the getView of our ImageAdapter (which extends ArrayAdapter),
I am attempting to use the LayoutInflater to inflate the xml, which I then store into a ViewGroup. I findViewByID() to get the imageView in the xml, and set the properties of the imageView that we would like.

If we keep inflating this xml file, all the id’s will be the same. Here is our issues.

  1. If we remove a list item with a
    context menu, it actually removes
    the incorrect one. Testing shows
    that it’s mostly the last one added,
    but not always.
  2. The EditText’s do not respond to keyboard input. On occasion, they’re store some data, usually always “bbb”.

We have more issues, but we’ll post back after we get these more serious errors fixed.

public View getView(int position, View convertView, ViewGroup parent)
    {
        final ImageView imageView;
        //InputStream is = null;
        final Context mContext = super.getContext();
        final AdapterItem item = super.getItem(position);
        final Uri imageUri = item.getUri();
        ViewGroup viewGroup = null;

        try
        {
            //-- If the view has not been created yet.
            if (convertView == null)
            {
                /*
                 * Build the ImageView from the URI with some custom
                 * view settings.
                 */

                viewGroup = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.mediauploadobject, null);
                imageView = (ImageView) viewGroup.findViewById(R.id.imgView);
                //imageView.setLayoutParams(new GridView.LayoutParams(IMAGE_WIDTH, IMAGE_HEIGHT));
                imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
                imageView.setPadding(IMAGE_PADDING_LEFT, IMAGE_PADDING_TOP,
                        IMAGE_PADDING_RIGHT, IMAGE_PADDING_BOTTOM);
                imageView.setDrawingCacheEnabled(true);
                imageView.setClickable(true);
                imageView.setFocusable(true);
                imageView.setFocusableInTouchMode(true);
                imageView.setSaveEnabled(false);
                //the following two lines are required for the menu to popUp
                imageView.setOnLongClickListener(new LongClickListener());
                imageView.setOnCreateContextMenuListener(new LongClickMenu());
                imageView.setOnClickListener(new ShortClickListener());

                //the following two lines are required to put a boarder around the images
                imageView.setOnTouchListener(new PictureOnTouchListener());
                imageView.setOnFocusChangeListener(new PictureOnFocusChangeListener());

                //-- Keep a reference to the ImageView by tagging it.
                imageView.setTag(imageUri);
            }else
            {
                //-- R-E-C-Y-C-L-E recycle!
                viewGroup = (ViewGroup) convertView;
                imageView = (ImageView) viewGroup.findViewById(R.id.imgView);
            }

            //-- Lazy load the images so the user doesn't have to wait for all of the querying non-sense
            //   that happens behind the scenes.
            imageView.setImageResource(android.R.drawable.gallery_thumb);
            imageView.post(new ImageLoader(imageUri, imageView));           

            //-- Be VERY careful when changing this code. Due to heap size issues,
            //   the size of the bitmap image MUST be modified with the
            //   provided BitmapFactory.Options or the program will
            //   crash often and frequent.
            //post
            //-- AJG 7/1/2010 added this assignment so we aren't always setting these preferences every
            //   iteration
            convertView = viewGroup;
        }catch(Throwable t)
        {
            Log.e(TAG, t.toString());
            return null;            
        }finally
        {
            //try{if(is != null)is.close();}catch(Exception squish){}
        }

        return viewGroup;
    }
  • 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-15T18:43:15+00:00Added an answer on May 15, 2026 at 6:43 pm

    Subviews aren’t focusable in a listview by default. This is to prevent odd trackball/non-touch navigation behavior. That might be why your edittexts aren’t responding to input. Make sure you’re calling the ListView.setItemsCanFocus(true) method.

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

Sidebar

Related Questions

I am doing some r &d in cocos2d.I have one backgroundLayer and add one
Doing some profiling (mem & speed) I've been stomped by the fact that win7
I'm doing some R&D work, and as such am exploring design patterns. I have
I am doing some Client & sever programs in that I will bring the
Doing some jquery animation. I have certain divs set up with an attribute of
While doing some refactoring I've found that I'm quite often using a pair or
I'm passing the company name to an onclick event. Some company names have apostrophes
I'm doing some HTML cleaning with BeautifulSoup. Noob to both Python & BeautifulSoup. I've
I am doing some work on a web site that has a secure area
I'm doing some automation work and can make my way around a site &

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.