D devjet Member Licensed User Longtime User Jun 25, 2011 #1 Hello, probably a no brainer for most of you.... I have just been reading this article and checked out the sample.http://www.b4x.com/forum/basic4andr...ls/6611-two-activities-example.html#post38609 How can I apply this if I use a set of multiple buttons on Activity 1? Activity 1 has 10 buttons (each represents a hard coded URL) Activity 2 there is a web View ( which should show the respective info of above URL of pressed button. As the buttons are individual controls I can not apply the list view sample Thanks for any hint!
Hello, probably a no brainer for most of you.... I have just been reading this article and checked out the sample.http://www.b4x.com/forum/basic4andr...ls/6611-two-activities-example.html#post38609 How can I apply this if I use a set of multiple buttons on Activity 1? Activity 1 has 10 buttons (each represents a hard coded URL) Activity 2 there is a web View ( which should show the respective info of above URL of pressed button. As the buttons are individual controls I can not apply the list view sample Thanks for any hint!
K kickaha Well-Known Member Licensed User Longtime User Jun 25, 2011 #2 If the buttons are in the "main" activity: Dim a string in the Sub Process_Globals of the main activity to hold the url for example Code: Dim MyUrl As String in the button event for each button set MyUrl to the Url you want, and start the second activity. In the second activity, you can get the Url with main.MyUrl, so you can use Code: WebView.LoadUrl (main.MyUrl) This can be further simplified by setting the event for all the buttons to be the same, and putting the url in the tag. The Click event for the buttons would then be Code: Dim btn As Button btn = Sender MyUrl=btn.Tag StartActivity (second activity) Upvote 0
If the buttons are in the "main" activity: Dim a string in the Sub Process_Globals of the main activity to hold the url for example Code: Dim MyUrl As String in the button event for each button set MyUrl to the Url you want, and start the second activity. In the second activity, you can get the Url with main.MyUrl, so you can use Code: WebView.LoadUrl (main.MyUrl) This can be further simplified by setting the event for all the buttons to be the same, and putting the url in the tag. The Click event for the buttons would then be Code: Dim btn As Button btn = Sender MyUrl=btn.Tag StartActivity (second activity)
D devjet Member Licensed User Longtime User Jun 26, 2011 #3 many thanks kickaha, I will try that ! Upvote 0