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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:17:56+00:00 2026-05-30T19:17:56+00:00

I asked this question yesterday, but I wrote it far more complicated than I

  • 0

I asked this question yesterday, but I wrote it far more complicated than I think this problem is. I am very confused and I found some very similar questions here, but neither of them solved my problem. So I have a listview, every listview contains an image, a textview and an edittext, but only the edittext is important.
If I click on the textview, I want to log the content of it for testing. My problem is if the user changes it then after the change I log the same thing. So changing it in the emulator and not using setText, it does nothing. I have a database, in every of the listview there is an edittext (holder.quant).

class MyAdapter extends ArrayAdapter
{

    LayoutInflater inflat;
    ViewHolder holder;
    public MyAdapter(Context context, int textViewResourceId,
            ArrayList<EachRow> objects) 
    {

        super(context, textViewResourceId, objects);
        // TODO Auto-generated constructor stub
        inflat=LayoutInflater.from(context);
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub

        if(convertView==null)
        {
            convertView=inflat.inflate(R.layout.row_checkox, null);
            holder=new ViewHolder();
            holder.textView=(TextView)convertView.findViewById(R.id.textView111);
            holder.image=(ImageView)convertView.findViewById(R.id.imageView111);



            holder.quant = (EditText)convertView.findViewById(R.id.quantity);


            holder.image.setOnClickListener(CustomList.this);
            convertView.setTag(holder);
        }
        holder=(ViewHolder) convertView.getTag();



        holder.textView.setOnClickListener(new View.OnClickListener() {


          @Override
            public void onClick(View v) {

                 TextView tv = (TextView) v ;
            String text_of_clicked_textview = tv.getText().toString();

             final String[] ddata = text_of_clicked_textview.split(" "); //split the result using the spaces (so you could obtain the name, hotness and the other string you use)


                final long yy = Long.parseLong(ddata[0]);



                info.open();
                info.updateQuan(yy, holder.quant.getText().toString());
                Log.i("tagitagi", holder.quant.getText().toString());
                info.close();
            }
        });



        EachRow row= getItem(position);
        EachRow row2= getItem2(position);
        holder.quant.setText(row2.text);

        holder.textView.setText(row.text);
        NullPointerException
        holder.image.setTag(position);
        holder.quant.setTag(position);

        return convertView;
    }

    @Override
    public EachRow getItem(int position) {
        // TODO Auto-generated method stub
        return list.get(position);
    }
    public EachRow getItem2(int position) {
        // TODO Auto-generated method stub
        return list2.get(position);
    }

    private class ViewHolder
    {
        TextView textView;
        ImageView image;
        EditText quant;


    }
}

private class EachRow
{
    String text;
    boolean checkBool;
}

I tried addTextChangedListener, but it gives me an error when I use settext. So what is the problem?

Thanks in advance!

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

    I managed to figure out how can I make it work. The holder.quant.gettext().toString does not work, even if I click on the textview of one of the rows I cannot log the content of the textview. The holder somehow blocks it, I will always log the same textview…

    So I needed to create a new method:

    public String getTextOfSelectedRow(int position) {
                           return list.get(position).text;
            }
    

    The list contains the rows, the .text comes from the method:

    private class EachRow
        {
            String text;
            boolean checkBool;
        }
    

    and the definition of the holder:

     public View getView(final int position, View convertView, ViewGroup parent) {
                // TODO Auto-generated method stub
    
                if(convertView==null)
                {
                    convertView=inflat.inflate(R.layout.row_checkox, null);
                    holder=new ViewHolder();
                    holder.textView=(TextView)convertView.findViewById(R.id.textView111);
                    holder.image=(ImageView)convertView.findViewById(R.id.imageView111);
    
                    holder.quant = (EditText)convertView.findViewById(R.id.quantity);
               holder.button = (Button)convertView.findViewById(R.id.dialogQuan);
                    holder.image.setOnClickListener(CustomList.this);
                    convertView.setTag(holder);
                }
                holder=(ViewHolder) convertView.getTag();
    
    
    
                holder.button.setOnClickListener(new View.OnClickListener() {....
    

    So after this the onClick method:

    kmultip = getTextOfSelectedRow(position).toString();
    

    So with this I can refer to the holder.quant or holder.textview or anything that is in a row. I still do not know why the simple holder.quant.getText().toString does not work, but with this, so refering to the position of a row will makes it work.

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

Sidebar

Related Questions

This is similar to a question I asked yesterday but more specific to the
i asked this question yesterday but it doesnt seem to have asked properly so
I asked a question about different testing frameworks yesterday. This question can be found
This is linked to a question I asked yesterday. Briefly, the problem I'm having
I asked a similar question like this yesterday but after waiting for ever I
So I asked this question yesterday, but the goal posts have changed and the
This problem is related to This question I asked yesterday. Now it seems that
I asked a similar question yesterday but still having a slight problem on output.
I asked this question yesterday got a pretty good answer but can't figure out
I asked this question yesterday, looking if more people can help me out. I

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.