0

I have a questions about passing a link from main activity to another activity. I am displaying a list view of RSS fields (I am using a news channel link). Now my work is to display the news in details on second activity. On click on any filed of list view of first activity, second activity should be displayed with that news in detail. I am not able to do that. Kindly suggest.

4

1 回答 1

0

Make use of IntentExtras.

In your list view activity, add extra as->

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    String url = "http://www.sudosaints.com"
    Intent intent = new Intent(FeedsListActivity.this, WebViewActivity.class);
    intent.putExtra("URL_EXTRA", url);
    startActivity(intent);
}

And in second activity, in onCreate getExtras as->

String url = getIntent().getStringExtra("URL_EXTRA");
于 2013-05-10T20:37:51.027 回答