CustomDialog don't open

mitsusdev

Member
Licensed User
Longtime User
Hi,
i've a problem when i try to auto-open a customDialog into a function outside Activity_Create.

So...from Main i call a service that exec a polling from an externa device. After polling..at the end, i exit from Service and re-call main activity passing it some data read from background service.

My problem is that if i try to open (when i return to Main Activity) a customDialog for view results extract from device...it don't work.

I don't able to see the return code of show method. Below pieces of my code:

Backgroud service
Code: Copy
If dataSendPlatform.Size = 1 Then
                                                
   Main.data = meterData.misura
   Main.timeMeasure = meterData.dataTime
   Main.extraData = meterData.fFlag
   AStream.Close
   Main.deviceType = "GLC"
   StartActivity(Main)
   CallSub(Main, "RefreshData")
   StopService(es)                     
                     
End If

..when i close the service, i call a subroutine from Main thath it perform a view data reload. If i have multiple data, i want to open a CustomDialog with all data passed from service to Main Activity (below a piece of relevant code):

Code: Copy
lv.Initialize("lv")      
pnl.Initialize("pnl")
         
Do While j < dataToSend.Size - 1  
    tmpDato = decodeDato(dataToSend.Get(j))
    line = tmpDato.misura & " mg/dl " & tmpDato.dataTime
    Log("Line: " & line)
    lv.AddSingleLine(line)
    j = j + 1
Loop
         
pnl.AddView(lv, 0, 0, 95%x, 300dip)
cd.AddView(pnl,0,0, 90%x, 60%y )
Log("Open Custom Dialog")
ret = cd.Show("Letture acquisite ", "OK", "","" , Null)
Log("CustomDialog Response: " & ret)

i've used CustomDialog and I've always managed to use it.

Thx a lot
 
Code: Copy
    StartActivity(Main)
    CallSub(Main, "RefreshData")
StartActivity sends a message to the internal message queue. When this message is processes the activity is started.
This means that the activity will not be active when you call CallSub (unless it was already visible).

OK Erel,
i've removed
Code: Copy
StartActivity(Main)
...and it now work fine.

Thanks a lot
 
Upvote 0
Back
Top