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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:37:07+00:00 2026-05-19T13:37:07+00:00

This is a noob question but I have to ask it anyway because I

  • 0

This is a noob question but I have to ask it anyway because I think I’ll go crazy soon.

What I want to achieve is a ListView that populates by twitter and this I have implemented, the two ListArrays gets populated by the tweet and the picture URL.
This is successful, but when I refresh twitter the new pile of twitter gets below the old ones.

I could simply clear the ListArrays but then all the twitter disappears in the list which is not desirable, I simply want to add only the new tweets, and make the new tweets get on top of the list.

So I guess this is a two fold question

  1. How do I make the list only to add
    which is not there?, and
  2. How do I make the latest tweet
    appear on top?

Could really use some great input, the code below is the most essential part of the (messy) code, which is the refresh method.

public void updateTwitter(){

        twitter = new TwitterFactory().getInstance();

        try {
            QueryResult result = twitter.search(new Query(TWEETQUERY));
            tweets = result.getTweets();
            for (Tweet tweet : tweets) {
                String tweetProfile = tweet.getProfileImageUrl();
                String twwwwww = tweet.getText();
                for(String tww : tweetString){

                    if(tww.equals(twwwwww)){
                        System.out.println("Not added");
                    } else {
                        tweetString.add(twwwwww);
                        urlArray.add(tweetProfile);
                    }
                }
            }
            if(adapter != null) {
                tweetList.setAdapter(adapter);
                System.out.println("adapter sets, not created");
            } else {
                adapter = new LazyAdapter(this, urlArray, tweetString);
                tweetList.setAdapter(adapter);
            }
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to search tweets: " + te.getMessage());
        }
    }
  • 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-19T13:37:07+00:00Added an answer on May 19, 2026 at 1:37 pm

    Presumably, the LazyAdapter derives from BaseAdapter and is backed by urlArray. If so, to have tweets appear on top, you need to add them to the beginning of the array.

    Use add(0, newEntry) to add to the beginning of the array and notifyDataSetChanged() to tell the adapter to post the updates.

    A couple of other notes:

    1) Its unclear to me what you intend, especially seeing code like twww.equals(twwwwwww). It seems like you’re maintaining the old tweets and trying to only add new ones, but with unclear variable names like twww, twwwwww, and tweetString, I can only guess.

    2) You shouldn’t have to keep setting the adapter. Once the relationship between the listview, adapter, and backing array is set, you should only have to update the array and notify the adapter.

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

Sidebar

Related Questions

This is a painfully noob question, but I have to ask it. I want
This is a noob question, but I will ask it anyway... I'm wanting to
i think this is a bit of a noob question, but here goes. I
This may sound like a noob question, because it is. I have tried for
Noob question here! I have an array with hashes that looks like this: arr
Hi Sorry for this noob question but here goes...i have a working slidetoggle on
Forgive me for this noob question, but is there such a setting that sets
This is probably a noob question that I will get slated for but here
Pardon me, this really is a noob question but please understand that I do
I feel noob asking this question but it seems that I cant find the

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.