Android Question tag & sender

hamedafrough

New Member
hello everyone
please help me, how can I relate between p1 (lkoleaza) & p2 (lkoleaza_slvlbl) with tag and sender
I want when boss clicked on the name of users, information of user show at activity p2.
thanks for your kindness.


codes of p1

B4X:
ub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("lkoleaza")
    ff.Initialize("ff")
    
    Main.ht1.Initialize("ht1",Me

    ProgressDialogShow("درحال برقراری با سرور. لطفا صبر کنید...")
    Main.ht1.Download("http://hamedafrough.ir/misaq/m_koleaza.php")

End Sub

************************************

Sub jobdone (job As HttpJob)
    
#region slv-beporsam
    If job.Success=True Then
        ProgressDialogHide
        jp.Initialize(job.GetString)
        list=jp.NextArray
        For i=0 To list.Size-1
'            Dim p As Panel
            p.Initialize("p")
            slvaza.Panel.AddView(p,0%x,top,95%x,45%y)
            p.LoadLayout("lkoleaza_mpinfo")
            p.Tag=i
            top=top+7%y+0%x
            
            Main.map_title=list.Get(i)
            Dim plusname As String=Main.map_title.Get("famili")&" "&Main.map_title.Get("nam")
'            Dim plusname As String=Main.map_title.Get("famili")&" "&Main.map_title.Get("nam")&" "&Main.map_title.Get("ozvkod")&" "&Main.map_title.Get("birth")&" "&Main.map_title.Get("shenas")&" "&Main.map_title.Get("kodemeli")&" "&Main.map_title.Get("sadere")&" "&Main.map_title.Get("mob1")&" "&Main.map_title.Get("mob2")&" "&Main.map_title.Get("tel1")&" "&Main.map_title.Get("tel2")&" "&Main.map_title.Get("fax")&" "&Main.map_title.Get("mail")&" "&Main.map_title.Get("manzel")&" "&Main.map_title.Get("kar")&" "&Main.map_title.Get("telegram")&" "&Main.map_title.Get("insta")&" "&Main.map_title.Get("bale")&" "&Main.map_title.Get("soroosh")&" "&Main.map_title.Get("ozviat")&" "&Main.map_title.Get("vaziat")&" "&Main.map_title.Get("nobat")&" "&Main.map_title.Get("vasete")&" "&Main.map_title.Get("vaminfo")&" "&Main.map_title.Get("vam")&" "&Main.map_title.Get("jari")&" "&Main.map_title.Get("estemhal")&" "&Main.map_title.Get("moavaq")&" "&Main.map_title.Get("masdoodi")&" "&Main.map_title.Get("blacklist")&" "&Main.map_title.Get("tozih")
            
            lblmp_id.Text=Main.map_title.Get("id")
            lblmp_nam.Text=plusname
            lblmp_nam.Tag=i

        Next
        slvaza.Panel.Height=top
    Else
        ToastMessageShow("خطا در برقراری ارتباط با سرور",False)
    End If
    Main.ht1.Release
#end region


sub lblmp_nam_Click
    Activity.Finish
    Dim btn_tag As Label
    btn_tag=Sender
    Log(btn_tag.Tag)
    Main.map_title = list.get(btn_tag.tag)
    StartActivity(lkoleaza_slvlbl)

End Sub

*******************************************
codes of p2

Sub Activity_Create(FirstTime As Boolean)

    Activity.LoadLayout("lkoleaza_slvlbl")
    slvaza.Panel.Height=160%y
    
    Main.ht1.Initialize("show_ht",Me)
    Main.ht1.Download("http://hamedafrough.ir/misaq/m_allaza.php")
end sub

******************************

    ProgressDialogHide
    If Job.Success=True Then
        
        Dim res As String
        res = Job.GetString

Sub JobDone(Job As HttpJob)

    jp.Initialize(res)   
    Main.list=jp.NextArray
'        For i=0 To Main.list.Size-1
    Dim p As Panel
    p.Initialize("p")
    slvaza.Panel.AddView(p,0%x,top,95%x,45%y)
    p.LoadLayout("lkoleaza_lbldata")
'        p.Tag=i
    top=top+15%y+0%x
        lblfamili.Text= Main.map_title.Get("famili")
        lblnam.Text= Main.map_title.Get("nam")
        lblozvkod.Text= Main.map_title.Get("ozvkod")
        lblbirth.Text= Main.map_title.Get("birth")
        lblshenas.Initialize("lblshenas")
        lblshenas.Text= Main.map_title.Get("shenas")
        lblkodemeli.Initialize("lblkodemeli")
        lblkodemeli.Text= Main.map_title.Get("kodemeli")
        lblsadere.Initialize("lblsadere")
        lblsadere.Text= Main.map_title.Get("sadere")
        lblmob1.Initialize("lblmob1")
        lblmob1.Text= Main.map_title.Get("mob1")
        lblmob2.Initialize("lblmob2")
        lblmob2.Text= Main.map_title.Get("mob2")
        lbltel1.Initialize("lbltel1")
        lbltel1.Text= Main.map_title.Get("tel1")
        lbltel2.Initialize("lbltel2")
        lbltel2.Text= Main.map_title.Get("tel2")
        lblfax.Initialize("lblfax")
        lblfax.Text= Main.map_title.Get("fax")
        lblmail.Initialize("lblmail")
        lblmail.Text= Main.map_title.Get("mail")
        lblmanzel.Initialize("lblmanzel")
        lblmanzel.Text= Main.map_title.Get("manzel")
        lblkar.Initialize("lblkar")
        lblkar.Text= Main.map_title.Get("kar")
        lbltelegram.Initialize("lbltelegram")
        lbltelegram.Text= Main.map_title.Get("telegram")
        lblinsta.Initialize("lblinsta")
        lblinsta.Text= Main.map_title.Get("insta")
        lblbale.Initialize("lblbale")
        lblbale.Text= Main.map_title.Get("bale")
        lblsoroosh.Initialize("lblsoroosh")
        lblsoroosh.Text= Main.map_title.Get("soroosh")
        lblozviat.Initialize("lblozviat")
        lblozviat.Text=Main.map_title.Get("ozviat")
        lblvaziat.Initialize("lblvaziat")
        lblvaziat.Text=Main.map_title.Get("vaziat")
        lbltozih.Initialize("lbltozih")
        lbltozih.Text=Main.map_title.Get("tozih")
'        Log (Main.map_title.Get("ozvkod"))
'        Next
        slvaza.Panel.Height=top
    Else
        ToastMessageShow("لطفا اتصال برنامه به اینترنت را بررسی کنید",False)
    End If
    Main.ht1.Release
'    Main.ht2.Release
end sub
 
Last edited:

Brian Dean

Active Member
Licensed User
I am afraid that few people will give you help if you post your code in PDF files - it is too cumbersome to work with.

Either show the code that demonstrates your problem by using "Insert code" tags (use the ". . ." icon on the menu strip at the top of the question input form) or upload your complete project (use the "Export as zip" item on the file menu in the B4A window).

Usually you will get help; this is an excellent forum with very many patient people who will give you assistance.
 

Brian Dean

Active Member
Licensed User
Here is a very simple solution - there are many other ways of doing this. I have not been through your PDFs to see exactly what you are doing, but this example should get you started.

In the main activity you declare a Process Global variable :

B4X:
Sub Process_Globals
    Dim identity As Int                    ' This value is available to all activities
End Sub
You create a common handler for the buttons (or other view types) that the user can select :

B4X:
Sub button_Click
    Dim btn As Button = Sender       ' Find the sender
    identity = btn.Tag                        ' Put the tag (identifier) in the process global value
    StartActivity(Activity2)                ' Call the other activity
End Sub
In Activity2 you check the process global value to see why you have been called :
B4X:
Sub Activity_Resume
    msg.Text = "Called with Identity = " & Main.identity
End Sub
I have attached the entire project. This will fill in some of the gaps in my explanation. I hope that it helps.
 

Attachments

Brian Dean

Active Member
Licensed User
Now that you have posted your code I would make one change to my previous post. Instead of making "Identity" an integer make it an object that holds an individual's details. Put this object in each button tag and pass it to Activity2 in the same way.
 

hamedafrough

New Member
Thank you for your answer
I carried out the orders, but my problem was not solved
I have put the link of my program above
If you have time to check, I will be grateful
I want to move to the second page by clicking on the user's name when the "lkoleaza" activity is loaded to display the user's details.
When I do this with my own codes, only the username and last name appear and the rest of the fields are not displayed, and even if they are displayed.
 

Brian Dean

Active Member
Licensed User
I have put the link of my program above
I cannot find that link. If you mean the code in your editted first post - that is not enough to work with. It does not include the layout or any global declarations so most of the variables are undefined; it will not compile. Use the "Export as zip" menu option that I mentioned before and send the whole project.
 

hamedafrough

New Member
I cannot find that link. If you mean the code in your editted first post - that is not enough to work with. It does not include the layout or any global declarations so most of the variables are undefined; it will not compile. Use the "Export as zip" menu option that I mentioned before and send the whole project.
Unfortunately, I could not understand your coding because my learning method was different and I did not have much experience.
I'm sending my file tonight to see. Thank you for your time

 
Last edited:
Top