• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Launch browser for RSS item on button click

cr5315

Android Enthusiast
I have an RSS reader app that normally launches a new activity with information about the RSS item the user clicked on, but there are too many problems with that, so I'm just going to make the app launch the browser to the link of the article. I've tried take the code I already had and make it launch, but that didn't work.

When a user clicks on an item,

Code:
 Intent intent = new Intent(AndroidRssReader.this, ShowDetails.class);
          	   Bundle bundle = new Bundle();
          	   bundle.putString("keyTitle", myRssFeed.getItem(position).getTitle());
          	   bundle.putString("keyDescription", myRssFeed.getItem(position).getDescription());
          	   bundle.putString("keyLink", myRssFeed.getItem(position).getLink());
          	   bundle.putString("keyPubdate", myRssFeed.getItem(position).getPubdate());
          	   intent.putExtras(bundle);
          	        startActivity(intent);

Which launches

Code:
@Override
protected void onCreate(Bundle savedInstanceState) {
 // TODO Auto-generated method stub
 super.onCreate(savedInstanceState);
 setContentView(R.layout.details);
 TextView detailsTitle = (TextView)findViewById(R.id.detailstitle);
 TextView detailsDescription = (TextView)findViewById(R.id.detailsdescription);
 TextView detailsPubdate = (TextView)findViewById(R.id.detailspubdate);
 TextView detailsLink = (TextView)findViewById(R.id.detailslink);

 Bundle bundle = this.getIntent().getExtras();
    
      detailsTitle.setText(bundle.getString("keyTitle"));
      detailsDescription.setText(bundle.getString("keyDescription"));
      detailsPubdate.setText(bundle.getString("keyPubdate"));
      detailsLink.setText(bundle.getString("keyLink"));
    
}
}

I tried to make it launch the browser with keyLink, but that didn't work.
 
as long as your "keylink" is a vaild url ie "http://www.google.com" this intent should work, did you try something like this ?


Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(bundle.getString("keyLink")));
startActivity(i);
 
Back
Top Bottom