Android Question undeclared variable 'activity' is used before it was assigned any value

Devv

Active Member
Licensed User
Longtime User
any ideas why i getting "undeclared variable 'activity' is used before it was assigned any value"


B4X:
Sub Process_Globals
    Dim soso As FTP_Auto  
End Sub
Sub Service_Create

End Sub

Sub Service_Start (StartingIntent As Intent)
    soso.Initialize(activity,Me,"ftp.DOMAIIN.com","USER","PASS",21,False,False)
    soso.UpLoadFile(File.DirRootExternal,"/htdocs","test.txt")
    soso.CloseNow
End Sub

Sub Service_Destroy

End Sub
 
Last edited:

marab

Member
Licensed User
Longtime User
replace activity in soso.initialize with your activity name! like Main!
 
Upvote 0

Devv

Active Member
Licensed User
Longtime User
Untitled.png



any ideas ?
 
Upvote 0

marab

Member
Licensed User
Longtime User
don't dim that in service use that from activity...
like :
B4X:
Main.soso.initialize(...
 
Upvote 0

Devv

Active Member
Licensed User
Longtime User
don't dim that in service use that from activity...
like :
B4X:
Main.soso.initialize(...

i' still facing problems may you edit the attached project please ?

i'm new here sorry for bothering you
 

Attachments

  • ftp_auto.zip
    6.5 KB · Views: 318
Upvote 0

marab

Member
Licensed User
Longtime User
use this for uploading this support services...
B4X:
Sub Process_Globals
  Dim FTP As FTP
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
  If FirstTime Then
    FTP.Initialize("ftp", ...)
    FTP.UploadFile(File.DirRootExternal, ...)
  End If
End Sub
Sub FTP_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
  Activity.Title = TotalUploaded
End Sub

Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
  Log("Completed: " & Success)
End Sub
 
Upvote 0
Top