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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:19:42+00:00 2026-06-02T09:19:42+00:00

i am creating custom listview. passing data to the edittext . at that time

  • 0

i am creating custom listview. passing data to the edittext . at that time it shows an error

                i try this code
                public View getView(int position, View convertView, ViewGroup parent) {
     final ViewHolder holder;


        if (convertView == null) {
            holder = new ViewHolder();

            convertView = inflater.inflate(R.layout.editfoodmenulistview, null);
            holder.caption = (EditText) convertView
                    .findViewById(R.id.foodmenu);

            holder.caption1=(ImageView) convertView.findViewById(R.id.foodimage);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        //Fill EditText with the value you have in data source

        holder.caption.setText(itemnames[position]);
        holder.caption.setId(position);
        holder.caption.setFocusableInTouchMode(true);

        holder.caption1.setImageBitmap(bmps[position]);    

        //we need to update adapter once we finish with editing
        holder.caption.setOnFocusChangeListener(new OnFocusChangeListener() {
            public void onFocusChange(View v, boolean hasFocus) {
            if(!hasFocus)
            {
                    final int position = v.getId();      
                    final EditText Caption = (EditText) v;
                    Caption.setFocusable(true);

                    holder.caption.setFocusable(true);
                    arr.remove(holder.caption.getId());
                    arr.add(holder.caption.getId(),holder.caption.getText().toString());


            }
                }

        });  



        return convertView;
    }
     }

      view holder(this is class)

 class ViewHolder {
 EditText caption;
ImageView caption1;
}

 class ListItem {
String caption;
}

the above viewholder class i used some other class get edittext. now i want reuse same edittext to another class.. it shows an error..please tell me how to solve the error

  • 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-02T09:19:45+00:00Added an answer on June 2, 2026 at 9:19 am

    Change this:

    convertView = inflater.inflate(R.layout.editfoodmenulistview, null);
    

    To this:

    convertView = inflater.inflate(R.layout.editfoodmenulistview, parent, false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating custom table view cells, but result is incorrect. My code: - (UITableViewCell
I have a list view that is displaying data using the gridview. This list
I am creating a custom listview. The data is not coming from a cursor
I'm creating an Android app that displays tv-shows on a listview. My shows coming
Hi I am creating a List View in another List View using this code
I'm often creating custom assertion methods for my JUnit tests. eg: public void assertArrays(String[]
Jython is great for creating custom data structures on need basis, but how to
I have mastered creating custom data types and adding fields with CCK. Then I
Hi i am creating a custom listview with texview ,imageview and i am accessing
After creating a custom Dialog using a ListView and my own implementation of ListAdapter

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.