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
B4X:
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):

B4X:
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
 

mitsusdev

Member
Licensed User
Longtime User

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

Thanks a lot
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…