This is an app which fetch a rss.xml file and shows the topic’s headings n a list view.. When an item(topic heading) of listview is clicked, it is opening in webview in Contenurl activity. But the page is blank. It means “feedUri” is not passing the value to Contenturl.java
If I replace “feedUri” with any address like http://google.com then it is working fine. Then if i click on any item of listview, google.com is opening in webview (within my app). But how can I pass the url value with “feedUri” ? Do I need to make any change in Contenurl.java file? plz help
This is the part of MainActivity.java
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Uri feedUri = Uri.parse(myRssFeed.getItem(position).getLink());
Intent w = new Intent(this, Contenturl.class);
w.putExtra(org.rss.mywindows.Contenturl.URL,feedUri);
startActivity(w);
here is Contenturl.java
public class Contenturl extends Activity {
public static final String URL = "";
private static final String TAG = "WebscreenClass";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contenturl);
String turl = getIntent().getStringExtra(URL);
Log.i(TAG, " URL = "+turl);
WebView webview = new WebView(this);
setContentView(webview);
// Simplest usage: No exception thrown for page-load error
webview.loadUrl(turl);
}
}
use
instead of
and in your Contenturl Activity
because you are sending Uri from first Activity and receiving it as String in another Activity. then solution is send it as String from first activity