如何在android中使rss自动收报机

时间:2014-03-03 09:51:39

标签: java android android-intent rss news-ticker

如何让android应用程序rss自动收报机, 我在http://www.itcuties.com/android/rss-reader-multicategory-reader-tab-layout-example/学习rss阅读器,但我想要创建rss自动收录器(运行文本)

 rss new ticker

这是来自网络http://www.itcuties.com/android/rss-reader-multicategory-reader-tab-layout-example/

的代码
public class RssTabsActivity extends TabActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // First, set the content view
    setContentView(R.layout.activity_rss_tabs);

    // Then get the TabHost
    TabHost tabHost = getTabHost();

    // Art tab
    Intent artIntent = new Intent().setClass(this, RssChannelActivity.class);
    // Set Art category RSS URL
    artIntent.putExtra("rss-url", "http://feeds.reuters.com/news/artsculture?format=xml");

    // The name of the art tab taken from the String resources
    String artTabName = getResources().getString(R.string.tab_art);
    TabSpec artTabSpec = tabHost.newTabSpec(artTabName)
                                .setIndicator(artTabName, getResources().getDrawable(R.drawable.rss_tab_art))
                                .setContent(artIntent);
    // Add art tab to the TabHost
    tabHost.addTab(artTabSpec);


    // Tech tab
    Intent techIntent = new Intent().setClass(this, RssChannelActivity.class);
    // Set Tech category RSS URL
    techIntent.putExtra("rss-url", "http://feeds.reuters.com/reuters/technologyNews?format=xml");

    // Tech tab name taken from the string resources
    String techTabName = getResources().getString(R.string.tab_tech);
    TabSpec techTabSpec = tabHost.newTabSpec(techTabName)
                                 .setIndicator(techTabName, getResources().getDrawable(R.drawable.rss_tab_tech))
                                 .setContent(techIntent);
    // Add tech tab to the TabHost
    tabHost.addTab(techTabSpec);


    // Sports tab
    Intent sportsIntent = new Intent().setClass(this, RssChannelActivity.class);
    // Set Sports category RSS URL
    sportsIntent.putExtra("rss-url", "http://feeds.reuters.com/reuters/sportsNews?format=xml");

    // Sports tab name - string resources
    String sportsTabName = getResources().getString(R.string.tab_sports);
    TabSpec sportsTabSpec = tabHost.newTabSpec(sportsTabName)
                                   .setIndicator(sportsTabName, getResources().getDrawable(R.drawable.rss_tab_sports))
                                   .setContent(sportsIntent);
    // Add sports tab to the TabHost
    tabHost.addTab(sportsTabSpec);


    // Set current tab to Technology
    tabHost.setCurrentTab(1);
}

}

请帮助

0 个答案:

没有答案