Android Question get data from different module

yes

Member
Licensed User
I'm a beginner and I need help desperately. here is the example, main module has ID.text variable from editText panel, meanwhile activity 2 has name.Text. So I want to create a loop in main activity where when name.text has user input data, main activity will run a certain program with it but when does not, program will run based on ID.text. here are the codings btw. this codes only return ID.text.

Sub button1_Click
If activity2.name.Text = True Then
FileName = activity2.name.Text & ".jpg"
Else
FileName = ID.Text & ".jpg"
Return
End If
image.Bitmap = LoadBitmap ( File.DirRootExternal, FileName)
End Sub
 
Last edited:

yes

Member
Licensed User
here is my sample project, or ideally is. please say anything wrong in my codes. thank you very much sir
 

Attachments

  • calling sub.zip
    38.4 KB · Views: 176
Upvote 0

yes

Member
Licensed User
thanks Erel. callsubdelayed pretty much solved the main problem. Can u give me some tutorial how to check whether edittext have user input data or not, in my case string. i stuck at this for a few days now. i tried using If activity2.name.Text = True. is it ok?
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
B4X:
if edittext.text.length = 0 then
  toastmessageshow("edittext is empty",false)
end if
or
B4X:
if edittext.text.trim = "" then
  toastmessageshow("edittext is empty",false)
end if



just like this?
 
Upvote 0

yes

Member
Licensed User
ronell, thanks. that solve my problem, i should have thought that. best regards folks, really help me a lot.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I had a look at your project.
There are some errors.
But I don't understand what exactly you want to do.
Do you really need Activity2?
You could do it without it.

Attached a modified version.
 

Attachments

  • callsubdelayed1.zip
    7.1 KB · Views: 150
Upvote 0
Top