Grab Tweet string value using Fabric for android



I am working on an android app and I am new to the Fabric API.

I am trying to grab the string values of the tweets. I can populate a ListActivity with all the tweets(code taken from the documentation examples), but cannot figure out how to access that list to get the string values or even the tweet ids.

When i do this:

Log.d("", adapter.getItem(1).toString());

Log.d("", adapter.getItem(1));

it tells me “Invalid Index 1, size is 0”

any help would be much appreciated!



Can you post more code? The size will be zero if the timeline hasn’t finished loading.


Hey thanks for your reply!

this is the code I’m using:

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;


public class TwitterFeed extends ListActivity {
    TweetTimelineListAdapter test;
    protected void onCreate(Bundle savedInstanceState) {
        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
        String username = pref.getString("username", "NULL");

        final UserTimeline userTimeline = new UserTimeline.Builder()
        final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(this)
    protected void onResume(){
        Log.d("ListItem", adapter.getItem(1).toString());


Likely the list hasn’t been loaded yet. Something like this belongs in a click handler. Maybe if you explain your use case better I can be more helpful.


My ultimate goal is to store the 140 character tweets (not the ids) in an accesible list/array/database.

You were right, the list was not loaded yet. I created a custom array adapter that extends theTweetTimelineListAdapter, and was able to get the tweet ids. Now it is a matter of turning those Ids into the actual tweets themself. I am not sure how to accomplish that yet. Any ideas?

Again, thank you for your reply.