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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:02:01+00:00 2026-06-12T16:02:01+00:00

How can I display text in TextView at get view after this call ListAdapter

  • 0

How can I display text in TextView at get view after this call

 ListAdapter adapter = new MyCustomAdapter ( 
                      ManageSection.this,  studentList, 
                        R.layout.list_student, new String[] { TAG_StudentID, 
                              TAG_StudentNo,TAG_FullName}, 
                        new int[] { R.id.StudentID, R.id.StudentNo,R.id.FullName}); 
               setListAdapter(adapter); 

and the class MyCustomAdapter has a get view, I will display the text

        holder.FullName= (TextView) convertView.findViewById(R.id.FullName);
        holder.FullName.setText();
        holder.StudentNo=(TextView) convertView.findViewById(R.id.StudentNo);
        holder.StudentNo.setText();

So at set text what should I write cause I do

no=student.get(holder.position).get(TAG_StudentNo);
            name =student.get(holder.position).get(TAG_FullName);

and take no, name but the text is duplicated in the whole list

 @Override
    public View getView(int position, View convertView, ViewGroup parent) {


     final ViewHolder holder;
        if(convertView==null)
        {
            LayoutInflater mInflater = (LayoutInflater)  context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = mInflater.inflate(resource, parent, false);
            holder = new ViewHolder();
            no=student.get(holder.position).get(TAG_StudentNo);
            name =student.get(holder.position).get(TAG_FullName);
            holder.StudentID= (TextView) convertView.findViewById(R.id.StudentID);
            holder.FullName= (TextView) convertView.findViewById(R.id.FullName);
            holder.FullName.setText();
            holder.StudentNo=(TextView) convertView.findViewById(R.id.StudentNo);
            holder.StudentNo.setText();
            holder.DeleteStudent = (ImageView) convertView.findViewById(R.id.DeleteStudent);
            holder.AlertIcon = (ImageView) convertView.findViewById(R.id.Alert);

         // add a listener for phone call
            holder.DeleteStudent.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {

                 id = student.get(holder.position).get(TAG_StudentID);
                Toast.makeText(getContext(),id,Toast.LENGTH_LONG).show();


                }

            });


            holder.AlertIcon.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {

                 //   String email = MyCustomAdapter.listMap.get(holder.position).get("email");
                  //  ActivityHelper.startActivity(ActivityManager.EMAIL, email);
                }

            });

            convertView.setTag(holder);

        }
        else
        {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.position = position;
        return convertView;
   }

    private static class ViewHolder
    {
        ImageView DeleteStudent;

        ImageView AlertIcon;

        TextView StudentID, StudentNo ,FullName;

        int position;
    }


}

Can anyone tell me what the problem is here?

  • 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-12T16:02:02+00:00Added an answer on June 12, 2026 at 4:02 pm

    Try this code.

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    
    
     final ViewHolder holder;
        if(convertView==null)
        {
            LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = mInflater.inflate(resource, parent, false);
            holder = new ViewHolder();
            convertView.setTag(holder);
    
        }
        else
        {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.position = position;
        no=student.get(holder.position).get(TAG_StudentNo);
        name =student.get(holder.position).get(TAG_FullName);
        holder.StudentID= (TextView) convertView.findViewById(R.id.StudentID);
        holder.FullName= (TextView) convertView.findViewById(R.id.FullName);
        holder.FullName.setText();
        holder.StudentNo=(TextView) convertView.findViewById(R.id.StudentNo);
        holder.StudentNo.setText();
        holder.DeleteStudent = (ImageView) convertView.findViewById(R.id.DeleteStudent);
            holder.AlertIcon = (ImageView) convertView.findViewById(R.id.Alert);
    
         // add a listener for phone call
            holder.DeleteStudent.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
    
                 id = student.get(holder.position).get(TAG_StudentID);
                Toast.makeText(getContext(),id,Toast.LENGTH_LONG).show();
    
    
                }
    
            });
    
    
            holder.AlertIcon.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
    
                 //   String email = MyCustomAdapter.listMap.get(holder.position).get("email");
                  //  ActivityHelper.startActivity(ActivityManager.EMAIL, email);
                }
    
            });
    
    
    
        return convertView;
    

    }

    private static class ViewHolder
    {
        ImageView DeleteStudent;
    
        ImageView AlertIcon;
    
        TextView StudentID, StudentNo ,FullName;
    
        int position;
    }
    

    }

    What you were doing is just setting the data only when the convertView is null and if not you just returning the view after some Holder operation. You need to set Text etc, in the textView in every case. If you need more explanation, please ask.

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

Sidebar

Related Questions

How can I display HTML text in textview? For example, string <h1>Krupal testing <span
How do I get my relative layout to display my image view like this:
Is there a way I can display text on a pygame window using python?
Can anyone suggest the best way to display a Textblock (with a text such
I want to display a mask in a text field. How can I do
I can display a simple Visual Basic inputbox from a PowerShell script like this:
In Visual Studio you can display the Call hierarchy of a single function. What
I need the ability to display a raw text file into a view and
I have a View comprised of two TextView if first is too wide can
i have to display text of the playing audio (file in sdcard). After given

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.