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

  • Home
  • SEARCH
  • 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 9170265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:59:35+00:00 2026-06-17T15:59:35+00:00

I had gone through various links, but I am unable to solve the problem

  • 0

I had gone through various links, but I am unable to solve the problem of losing the content from the list view,

MessageAdapter.java

class MessageAdapter extends BaseAdapter {

     ViewHolder viewHolder;
     LayoutInflater inflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);

     public int getCount() {
            // TODO Auto-generated method stub
            return Constant_Variables.Sms_Status_list.size();
        }

     public Object getItem(int position) {
            // TODO Auto-generated method stub
            return position;
        }

     @Override
     public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        }



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

         if (convertView == null) {
             convertView = inflater.inflate(R.layout.messagelist_row, null);

             viewHolder=new ViewHolder();

             viewHolder.sms_from_row=(TextView)convertView.findViewById(R.id.sms_from_txtview);
             viewHolder.sms_to_row=(TextView)convertView.findViewById(R.id.sms_sendto_txtview);
             convertView.setTag(viewHolder);

         }
         else
         {
             viewHolder = (ViewHolder) convertView.getTag();
         }

         if(Constant_Variables.Sms_Status_list.get(position).equalsIgnoreCase(Twilioresponse_Utils.sms_sent))
         {
             viewHolder.sms_from_row.setVisibility(View.GONE);
             viewHolder.sms_to_row.setText("Sent: "+Constant_Variables.Sms_from_list.get(position));

         }
         else if(Constant_Variables.Sms_Status_list.get(position).equalsIgnoreCase(Twilioresponse_Utils.sms_received))
         {
             viewHolder.sms_to_row.setVisibility(View.GONE);
             viewHolder.sms_from_row.setText("Received: "+Constant_Variables.Sms_to_list.get(position));
         }
         else
         {
             viewHolder.sms_from_row.setText("Message in queued.");
         }


         convertView.setTag(viewHolder);


         return convertView;
     }
 }


    class ViewHolder {
         TextView sms_from_row,sms_to_row;

     }

when I do not set visibility to gone, list data is not lost, but when i set visibility to gone, then the list data is lost.

This is the XML file which i am using to show the text:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/sms_from_txtview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="12dp"
        android:text="From" />

    <TextView
        android:id="@+id/sms_sendto_txtview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="12dp"
        android:text="To" />
</LinearLayout>
  • 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-17T15:59:36+00:00Added an answer on June 17, 2026 at 3:59 pm

    You do

    viewHolder.sms_from_row.setVisibility(View.GONE);
    viewHolder.sms_to_row.setVisibility(View.GONE);
    

    but you never do

    viewHolder.sms_from_row.setVisibility(View.Visible);
    viewHolder.sms_to_row.setVisibility(View.Visible);
    

    Change your code:

    else
         {
             viewHolder = (ViewHolder) convertView.getTag();
         }
    
    // ADD THIS TWO LINES
    viewHolder.sms_from_row.setVisibility(View.Visible);
    viewHolder.sms_to_row.setVisibility(View.Visible);
    
         if(Constant_Variables.Sms_Status_list.get(position).equalsIgnoreCase(Twilioresponse_Utils.sms_sent))
         {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had gone through many solutions for the above problem but they are quite
I had gone through the tutorial in Prestashop at http://forge.prestashop.com:8081/display/PS14/Using+the+REST+webservice but it doesn't guide
I had gone through a link on parsing Json data on Android, but didnt
Had to download Command Line Tools from Apple to get make to work, but
Had a good read through similar topics but I can't quite a) find one
Having had some Sql Compact db corruption issues in the past and gone through
I had gone through through some of the common questions here in the forum
Hi i need to play a song from the itunes library. I had gone
You must had gone through this before coming to my this question. How to
I had recently starting learning openGLES and right now I had gone through some

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.