Kyle
Kyle

Reputation: 1

Android Intent usage

I am working developing a tab layout based RSS Feed reader app for my android. I have four different sites to get the feeds from and each feed should go into the separate tab. Now I have the app working fine but I was just wondering if there is a way to pass in the feed url while invoking the feed activity?

I guess what I am after is to make my code more generic. When I invoke a new tab view using an intent I want to pass in the url for feed to the class being invoked in addition to the Class name and the intent. For example currently I have the following code for each RSS feed:

Intent i = new Intent(this, RSSReader.class);
spec = tabHost.newTabSpec("Tab1").setIndicator("Tab1").setContent(i);
tabHost.addTab(spec);

where RSSReader holds my url that would be displayed in "Tab1". Is there a way to tell RSSReader which url it is supposed to display based on the tab selected? I tried looking up the API but I couldn't find anything useful or may be I might have missed it. Any help in the matter would be appreciated!

Upvotes: 0

Views: 241

Answers (2)

ykatchou
ykatchou

Reputation: 3727

You may put the url into a bundle. A bundle could be give to the intent :)

Upvotes: 1

success_anil
success_anil

Reputation: 3658

hmm.. As far as I know give this a try too. Pass the intent.putExtra("yourvariable","yourvariable value"). before setting the intent to be the content of tabHost.......

Upvotes: 1

Related Questions