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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:19:27+00:00 2026-06-03T18:19:27+00:00

I try to implement homeline pagination via Twitter4j to pull-to-refresh list from Chris Banes.

  • 0

I try to implement homeline pagination via Twitter4j to pull-to-refresh list from Chris Banes. However, I have problems of that how to realize it. I have some notes how it should work but it isn’t so, my pull refresh list doesn`t refresh. Have any ideas how to upload next 40 tweet to list on refresh?

Activity

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tweetlist);

        initializeVars();
        paging = new Paging(1, 40);

        try {
            ListView actualListView = pullToRefreshView.getRefreshableView();

            tweets = twitter.getHomeTimeline(paging);
            tweetAdapter = new TweetListAdapter(this, R.layout.customtweetlist, tweets);
            actualListView.setAdapter(tweetAdapter);
        } catch (TwitterException e) {
            e.printStackTrace();
        }
    }

public void onRefresh() {
        new GetDataTask().execute();
    }

    private class GetDataTask extends AsyncTask<Void, Void, List<Status>> {

        protected List<twitter4j.Status> doInBackground(Void... params) {
            paging.setPage(2);
            try {
                tweets = twitter.getHomeTimeline(paging);
            } catch (TwitterException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return tweets;
        }

        protected void onPostExecute(List<twitter4j.Status> result) {
            tweetAdapter.notifyDataSetChanged();

            // Call onRefreshComplete when the list has been refreshed.
            pullToRefreshView.onRefreshComplete();

            super.onPostExecute(result);
        }
    }

My TweetAdapter

public class TweetListAdapter extends ArrayAdapter<Status> {
    private final Context context;
    private final List<Status> values;

    public TweetListAdapter(Context context,int textViewResourceId, List<Status> tweets) {
        super(context, textViewResourceId, tweets);
        this.context = context;
        this.values = tweets;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View rowView = inflater.inflate(R.layout.customtweetlist, parent, false);
        TextView textView = (TextView) rowView.findViewById(R.id.tvText);
        ImageView imageView = (ImageView) rowView.findViewById(R.id.ivImage);
        Status tweet = values.get(position);
        textView.setText(tweet.getText());

    //  imageView.setImageBitmap(getBitmap(tweet.getProfileImageUrl()));
        rowView.invalidate();

        return rowView;
    }

    public static Bitmap getBitmap(String bitmapUrl) {
        try {
            URL url = new URL(bitmapUrl);
            return BitmapFactory.decodeStream(url.openConnection() .getInputStream()); 
        }
        catch(Exception ex) {return null;}
    }
}
  • 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-03T18:19:29+00:00Added an answer on June 3, 2026 at 6:19 pm

    So what’s happening is that you’re updating the tweets variable, which will update the Adapter’s this.values value, HOWEVER that list is not what the adapter is using to render the list (if you want to know why, just dig into the ArrayAdapter code). The easiest way to fix the problem (and prevent further confusion) is to extend from BaseAdapter. It’s a bit more work for you but you will have full control of what the adapter does (and will understand what’s going on better).

    To clean the code some more, you should also add a metod to your adapter that updates the value of this.values, you shouldn’t depend on it referring to the same list as tweets.

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

Sidebar

Related Questions

I try to implement Hash join in Hadoop. However, Hadoop seems to have already
I try to implement GCM in my project and have problems with onMessage function.
i am just try to implement the tutorial from here but i have problem
I try to implement an initialization method for my own type. However after calling
The way I try implement it via standart Windows.Forms (to get valide DialogResult.OK) System.Windows.Forms.SaveFileDialog
I try to implement callback interface with COM techonlogy and have IDL like that:
I try implement advance on my question form here: send parameter from view-model to
Hi I try implement solution from this site im my WPF app for global
I try to implement a build pipeline using TFS. We already have TFS building
I try to implement input user mask via that lesson and can't run it.

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.