Android Question Problems with class

FrankDev

Active Member
Licensed User
Longtime User
hello

I have a little problem with a Routine. I want to move into a class.
somehow the problem is also clear to me, but I don't know how to solve it.
I have the function

Show_InputBox' in the activity everything works without problems.
If I move it into a class module I get the following error message:

'An Activity Context is required.
This Class has no process Content
Additing a global Activity object variable will fix this issue.'

regards Frank

B4X:
Wait For(Show_InputBox("Keywort eingeben","", "ok","cancel","")) Complete (ergebnis As String)

public Sub Show_InputBox(title As String, default As String, ok As String, cancel As String, neg As String) As ResumableSub
 
 Dim dlg As CustomLayoutDialog
 Private Eingabefeld As EditText
  
 Dim sf As Object = dlg.ShowAsync(title, ok, cancel, neg, Null, False)
 dlg.SetSize(100%x, 250dip)
  
 Wait For (sf) Dialog_Ready (DialogPanel As Panel)
 Eingabefeld.Initialize("")
 Eingabefeld.Hint = default
 
 DialogPanel.AddView(Eingabefeld,5%x,30dip,80%x,50dip)
 Wait For (sf) Dialog_Result (Result As Int)
 If Result = DialogResponse.POSITIVE Then
  Return Eingabefeld.Text.trim
 Else
  Return ""
 End If
 
End Sub
 

stevel05

Expert
Licensed User
Longtime User
Strange, it works OK for me.

Ooops, I downloaded Semen's app.

It shows how useful a demo app is.
 
Upvote 0
Top