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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:38:52+00:00 2026-06-04T12:38:52+00:00

I have start a timer which call getMessage webservice which return comming message for

  • 0

I have start a timer which call getMessage webservice which return comming message for that user arraylist size always show right number of messages but when show in list view of that message show only last message send give by web service I have use this code.

public void handleMessage(Message msg) 
    {
        super.handleMessage(msg);

        if(msg.arg1!=RECIEVEFAILURE)
           {
            objrReceiveMessageSiteList =(ArrayList<ReceiveMessageSiteList>)msg.obj;
            System.out.println("objrReceiveMessageSiteList.get(0)"+objrReceiveMessageSiteList.get(0).getMessageStatus());
            System.out.println("objrReceiveMessageSiteList.get(0)"+objrReceiveMessageSiteList.size());
            if(objrReceiveMessageSiteList.size()!=0 && !objrReceiveMessageSiteList.get(0).getMessageStatus().equalsIgnoreCase("No New Message"))
            {
                for(int i=0;i<objrReceiveMessageSiteList.size();i++)
                {
                    objkeyvaluepair.setMessage(objrReceiveMessageSiteList.get(i).getMessage());
                    objkeyvaluepair.setMessageType(objrReceiveMessageSiteList.get(i).getMessageType());
                    objkeyvaluepair.setTimeStamp(objrReceiveMessageSiteList.get(i).getTimeStamp());
                    objkeyvaluepair.setSenderFirstName(objrReceiveMessageSiteList.get(i).getSenderFirstName());
                    objkeyvaluepair.setSenderId(objrReceiveMessageSiteList.get(i).getSenderId());
                    objkeyvaluepair.setRecieverFirstName(objrReceiveMessageSiteList.get(i).getReceiverFirstName());
                    messagerecord.add(objkeyvaluepair);
                    System.out.println("MESSAGE SIZE"+messagerecord.size());
                    System.out.println("MESSAGE---------- findeee"+messagerecord.get(i).getMessage());

                }
                System.out.println("objrReceiveMessageSiteList.get(0)--------------"+objrReceiveMessageSiteList.get(0).getMessageStatus());
                message.setText(""+messagerecord.size());
            }
    }

    }
};

inside this for loop arraylist is showing right message in syste.out.println.but when sending in adapter set adapter take right size but show only last message in all list view.please help me

  • 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-04T12:38:53+00:00Added an answer on June 4, 2026 at 12:38 pm

    change this method to the following:

    public void handleMessage(Message msg) 
        {
            super.handleMessage(msg);
    
            if(msg.arg1!=RECIEVEFAILURE)
               {
                objrReceiveMessageSiteList =(ArrayList<ReceiveMessageSiteList>)msg.obj;
                System.out.println("objrReceiveMessageSiteList.get(0)"+objrReceiveMessageSiteList.get(0).getMessageStatus());
                System.out.println("objrReceiveMessageSiteList.get(0)"+objrReceiveMessageSiteList.size());
                if(objrReceiveMessageSiteList.size()!=0 && !objrReceiveMessageSiteList.get(0).getMessageStatus().equalsIgnoreCase("No New Message"))
                {
                    for(int i=0;i<objrReceiveMessageSiteList.size();i++)
                    {
                        //Create Local object of the Objkeyvaluepair here, for example
                        //ObjectKeyValuePair objkeyvaluePair=new OjectKeyvaluePair();
                        objkeyvaluepair.setMessage(objrReceiveMessageSiteList.get(i).getMessage());
                        objkeyvaluepair.setMessageType(objrReceiveMessageSiteList.get(i).getMessageType());
                        objkeyvaluepair.setTimeStamp(objrReceiveMessageSiteList.get(i).getTimeStamp());
                        objkeyvaluepair.setSenderFirstName(objrReceiveMessageSiteList.get(i).getSenderFirstName());
                        objkeyvaluepair.setSenderId(objrReceiveMessageSiteList.get(i).getSenderId());
                        objkeyvaluepair.setRecieverFirstName(objrReceiveMessageSiteList.get(i).getReceiverFirstName());
                        messagerecord.add(objkeyvaluepair);
                        System.out.println("MESSAGE SIZE"+messagerecord.size());
                        System.out.println("MESSAGE---------- findeee"+messagerecord.get(i).getMessage());
    
                    }
                    System.out.println("objrReceiveMessageSiteList.get(0)--------------"+objrReceiveMessageSiteList.get(0).getMessageStatus());
                    message.setText(""+messagerecord.size());
                }
        }
    
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like a timer class that allows me to call: .start()   .getElapsedTime()  
I have created an application.in the app i start a countdown timer and save
So I have a very simple android activity that starts a timer when you
I have a webpage that, when you click start patrolling, starts counting the time
I have a function which makes a call to the server to load some
I have a Javascript block in which it creates a timer based on mouse
I have a thread, within this thread I call a method which takes a
I have a function that sets a timer, and calls itself back upon expiration
I have the code: var timer:Timer = new Timer(milliseconds, repititions); timer.addEventListener(TimerEvent.TIMER, callback); timer.start(); and
I have a windows service written in c#. It has a timer inside, which

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.