开发者

Twitter4J timeline in Android ListView

I am using Twitter4J to get a public timeline from twitter. I want to display the data in a ListView but I don't know what to do with the List<Status> type I get from twitter4j. How do I get that into an Array so that I can use it with my ArrayAdapter.

If I am going about this completely wrong I apologize. I am new to Java and Android.

EDIT:

To be more clear I am trying to display my timeline in a ListView. I am using this code to get the timeline:

 Twitter twitter = new TwitterFactory().getInstance();
    try {
        List<Status> statuses = twitter.getPublicTimeline();

        System开发者_JAVA百科.out.println("Showing public timeline.");
        for (Status status : statuses) {
            System.out.println("@" + status.getUser().getScreenName() + " + " + status.getText());
        }
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to get timeline: " + te.getMessage());
        System.exit(-1);
    }

How do I display that data in a ListView though? I know how to display a string array in a ListView using an ArrayAdapter but I am not sure what to do with this.


For storing the timeline , u can use an SQLite Database . For displaying , you can extend the class simpleCursorAdapter which maps the database values to the views . More info :- http://marakana.com/forums/android/examples/72.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜