Android Question Multiple Activities. Get events

Jean Weets

Member
Licensed User
Longtime User
In a Multiple Activity I have problems with the ItemClick event of eg. listview. This does not work.
Button events works.
In debug mode, I can not watch variables. He stops at a breakpoint. But in the emulator he continues.
My code of a second activity:


B4X:
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Public LKUser As ListView
    Private PKUser As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("PageKiesUser")
    KiesUser
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub KiesUser
    If File.IsDirectory(Main.TargetDir, "Diensttabel/") = False Then
        File.MakeDir(Main.TargetDir, "Diensttabel")
    End If
    'lbl.Initialize("")
    LKUser.Clear
    Dim flpds As List = File.ListFiles(Main.TargetDir & "/Diensttabel")
    If flpds.size = 0 Then
        Activity.RemoveAllViews
        StartActivity(Sync)
    Else
        Dim flsok As Boolean = False
        For x = 0 To flpds.Size -1
            Dim flna As String = flpds.Get(x)
            If flna.EndsWith(".pds") Then
                 LKUser.AddSingleLine(flna)
            End If
            If flna = Main.yr & ".sks" Then
                flsok = True       
            End If
        Next
        If flsok Then
            PKUser.Visible=True
        Else
            Activity.RemoveAllViews
            StartActivity(Sync)
        End If
    End If
End Sub

Sub LKUser_ItemClick (Position As Int, Value As Object)
    Main.drn = LKUser.GetItem(Position)
    Main.drn = Main.drn.SubString2(0,Main.drn.Length-4)
    StartActivity("Main")
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
If you create it with the designer you do not need to initialize the views.
What is the eventname which is set in the designer for LKUser?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
As there's no Global sub's in your post
really?
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Public LKUser As ListView
    Private PKUser As Panel
End Sub
 
Upvote 0
Top