Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have four groups in a listview each with four url's I want to load in a webView. When the user select a url to goto I set a value like so;

 if (position == 0) webb = webb +2;
 {
       Intent intent = new Intent(this, official.class);
       startActivity(intent);
 }

I then carryout the intent to move to the webView class where I have given each url a value like so;

if (webb == 2) mWebView.loadUrl("http://yahoo.com");
if (webb == 3) mWebView.loadUrl("http://www.bbc.co.uk");

But the screen stays blank, if I state the value inside the official.class it works.

How can I get this value to pass to another class based on the selection the user makes from the listview. Sorry if this is hard to understand.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
120 views
Welcome To Ask or Share your Answers For Others

1 Answer

If your question is how to share data between activities (such as your webb value), then you might want to look at the Intent.putExtra(...) methods. More info:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...