Android Question CustomListView Click to Lauch Another Activity with Value Preset

pemulanih

Member
Main
B4X:
Sub JSONListing(jsonstring As String)
Dim parser As JSONParser
    parser.Initialize(jsonstring)
Dim root As Map = parser.NextObject
Dim results As List = root.Get("results")
For Each colresults As Map In results
Dim title As String = colresults.Get("title")
Dim description As String = colresults.Get("description")
Dim urlid As String= colresults.Get("idl")
        CustomListView1.AddTextItem(title&"   "&"("&description&")",urlid) 'urlid is Value which contain URL i want to load to activity 2'
    Next
    
End Sub

Sub CustomListView1_ItemClick (Index As Int, Value As Object)
  
    StartActivity(activity2) ' i want to load wv.loadurl(Value) in activity 2
    
End Sub

activity2
B4X:
Sub Activity_Create(FirstTime As Boolean)
    
    wv.Initialize("wv")
    Activity.AddView(wv, 0, 0, 100%x, 100%y)
    wve.Initialize(wv)
    wve.JavaScriptEnabled = True
    JavascriptInterface1.Initialize
    wve.AddJavascriptInterface(JavascriptInterface1, "B4A")
    cc.Initialize("cc")
    wve.SetWebChromeClient(cc)
    
    wv.LoadUrl(Value) '<-- this is that i want..(load value from customlistview in main activity)'
    
End Sub

how to do that,.. i mean catch the value of customlistview from main activity then load to another activity (activity2)?

thanks in advance....
 

Mahares

Expert
Licensed User
Longtime User
how to do that,.. i mean catch the value of customlistview from main activity then load to another activity (activity2)?
In process globals of the 1st act:
B4X:
Sub Process_Globals    
    Public MyUrl As String
End Sub

B4X:
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
    MyUrl=Value
    StartActivity(Activity2) ' i want to load wv.loadurl(Value) in activity 22
End Sub

In the 2nd Act.
B4X:
wv.LoadUrl(Main.MyUrl)
 
Upvote 0
Top